84 lines
2.9 KiB
Python
84 lines
2.9 KiB
Python
# barbacompta - invoicing for dummies
|
|
# Copyright (C) 2019-2020 Entr'ouvert
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify it
|
|
# under the terms of the GNU Affero General Public License as published
|
|
# by the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
def test_homepage(app):
|
|
response = app.get("/").follow()
|
|
|
|
response.form.set("username", "admin")
|
|
response.form.set("password", "admin")
|
|
|
|
homepage = response.form.submit().follow()
|
|
|
|
clients = homepage.click("Clients")
|
|
str(clients)
|
|
ajouter_un_client = homepage.click("Ajouter un client")
|
|
str(ajouter_un_client)
|
|
contrats = homepage.click("Contrats")
|
|
contrat_2c210afd24c11596eeaf94bfb = contrats.click('2c210afd24c11596eeaf94bfb', href='change')
|
|
str(contrat_2c210afd24c11596eeaf94bfb)
|
|
ajouter_un_contrat = homepage.click("Ajouter un contrat")
|
|
str(ajouter_un_contrat)
|
|
compte_en_banque = homepage.click("Compte en banque")
|
|
str(compte_en_banque)
|
|
factures = homepage.click("Factures")
|
|
factures_00137 = factures.click('F20190137')
|
|
str(factures_00137)
|
|
rapid = factures.click('Rapid')
|
|
str(rapid)
|
|
|
|
|
|
def test_ods_export(app):
|
|
response = app.get("/eo_facture/facture/").follow()
|
|
|
|
response.form.set("username", "admin")
|
|
response.form.set("password", "admin")
|
|
|
|
factures = response.form.submit().follow()
|
|
|
|
response = factures.click('Export ODS')
|
|
assert 'factures.ods' in response['Content-Disposition']
|
|
|
|
|
|
def test_odt_export(app):
|
|
response = app.get("/eo_facture/contrat/").follow()
|
|
response.form.set("username", "admin")
|
|
response.form.set("password", "admin")
|
|
|
|
contracts = response.form.submit().follow()
|
|
form = contracts.forms['changelist-form']
|
|
for i in range(5):
|
|
form.set('_selected_action', True, index=i)
|
|
form['action'] = 'export_references_as_fodt'
|
|
res = form.submit('Go')
|
|
assert res.status_code == 200
|
|
assert res.content_type == 'application/vnd.oasis.opendocument.text'
|
|
|
|
|
|
def test_zip_export(app):
|
|
response = app.get("/eo_facture/facture/").follow()
|
|
response.form.set("username", "admin")
|
|
response.form.set("password", "admin")
|
|
|
|
factures = response.form.submit().follow()
|
|
form = factures.forms['changelist-form']
|
|
for i in range(5):
|
|
form.set('_selected_action', True, index=i)
|
|
form['action'] = 'export_invoices_as_zip'
|
|
res = form.submit('Go')
|
|
assert res.status_code == 200
|
|
assert res.content_type == 'application/zip'
|