|
@@ -142,31 +142,31 @@ class BillingInvoiceCreationTests(TestCase):
|
|
|
|
|
|
class BillingTests(TestCase):
|
|
|
|
|
|
- # def test_download_invoice_pdf_return_a_pdf(self):
|
|
|
- # """
|
|
|
- # Test que le téléchargement d'une facture en format pdf retourne bien un
|
|
|
- # pdf
|
|
|
- # """
|
|
|
- # # Créé un membre
|
|
|
- # username = MemberTestsUtils.get_random_username()
|
|
|
- # member = Member(first_name='A', last_name='A',
|
|
|
- # username=username)
|
|
|
- # member.set_password('1234')
|
|
|
- # member.save()
|
|
|
-
|
|
|
- # # Créé une facture
|
|
|
- # invoice = Invoice(member=member)
|
|
|
- # invoice.save()
|
|
|
- # invoice.validate()
|
|
|
-
|
|
|
- # # Se connect en tant que le membre
|
|
|
- # client = Client()
|
|
|
- # client.login(username=username, password='1234')
|
|
|
- # # Tente de télécharger la facture
|
|
|
- # response = client.get('/billing/invoice/%i/pdf' % invoice.id)
|
|
|
- # # Vérifie return code 200 et contient chaine %PDF-1.
|
|
|
- # self.assertContains(response, '%PDF-1.', status_code=200, html=False)
|
|
|
- # member.delete()
|
|
|
+ def test_download_invoice_pdf_return_a_pdf(self):
|
|
|
+ """
|
|
|
+ Test que le téléchargement d'une facture en format pdf retourne bien un
|
|
|
+ pdf
|
|
|
+ """
|
|
|
+ # Créé un membre
|
|
|
+ username = MemberTestsUtils.get_random_username()
|
|
|
+ member = Member(first_name='A', last_name='A',
|
|
|
+ username=username)
|
|
|
+ member.set_password('1234')
|
|
|
+ member.save()
|
|
|
+
|
|
|
+ # Créé une facture
|
|
|
+ invoice = Invoice(member=member)
|
|
|
+ invoice.save()
|
|
|
+ invoice.validate()
|
|
|
+
|
|
|
+ # Se connect en tant que le membre
|
|
|
+ client = Client()
|
|
|
+ client.login(username=username, password='1234')
|
|
|
+ # Tente de télécharger la facture
|
|
|
+ response = client.get('/billing/invoice/%i/pdf' % invoice.id)
|
|
|
+ # Vérifie return code 200 et contient chaine %PDF-1.
|
|
|
+ self.assertContains(response, b'%PDF-1.', status_code=200, html=False)
|
|
|
+ member.delete()
|
|
|
|
|
|
def test_that_only_owner_of_invoice_can_access_it(self):
|
|
|
"""
|