diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-14 18:29:47 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-14 18:29:47 +0200 | 
| commit | 5ca7407d99b07694fd5facf612f3d2c8562c000b (patch) | |
| tree | 0aa879bf17c6dfab7879c85f76f15a69d2a843a8 /archaeological_operations/tests.py | |
| parent | 26a7508ea2ae47ccbaf0e0bfc0d2bd4f64482824 (diff) | |
| download | Ishtar-5ca7407d99b07694fd5facf612f3d2c8562c000b.tar.bz2 Ishtar-5ca7407d99b07694fd5facf612f3d2c8562c000b.zip | |
Fix file imports - fix tests with redirs
Diffstat (limited to 'archaeological_operations/tests.py')
| -rw-r--r-- | archaeological_operations/tests.py | 23 | 
1 files changed, 16 insertions, 7 deletions
| diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 6c20df85a..9466257a4 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -1681,7 +1681,7 @@ class LockTest(TestCase, OperationInitTest):          step = 'selec-operation_modification'          response = cls_wiz.wizard_post(              self.client, url, step, {'pk': self.operation.pk}) -        msg = str(_("This operation is locked for edition.") +        msg = str(_("This item is locked for edition.")                    ).replace("'", "'")          self.assertIn(msg, response.content.decode(),                        msg="wizard lock for edition not effective") @@ -2514,6 +2514,9 @@ class OperationWizardCreationTest(WizardTest, OperationInitTest, TestCase):      url_name = 'operation_creation'      wizard_name = 'operation_wizard'      steps = views.wizard_steps +    redirect_url = "/operation_modification/selec-operation_modification"\ +                   "?open_item={last_id}" +    model = models.Operation      form_datas = [          FormData( @@ -2632,6 +2635,8 @@ class OperationWizardModifTest(WizardTest, OperationInitTest, TestCase):      url_name = 'operation_modification'      wizard_name = url_name + '_wizard'      steps = views.operation_modif_wizard_steps +    redirect_url = "/{url_name}/selec-{url_name}?open_item={current_id}" +    model = models.Operation      base_ignored_steps = (          'archaeologicalsite-operation_modification',          'preventive-operation_modification', @@ -2826,11 +2831,12 @@ class OperationWizardDeleteTest(OperationWizardCreationTest):      url_name = 'operation_deletion'      wizard_name = 'operation_deletion_wizard'      steps = views.operation_deletion_steps +    redirect_url = "/{}/selec-{}".format(url_name, url_name)      form_datas = [          FormData(              "Wizard deletion test",              form_datas={ -                'selec-operation_deletion': {'pk': None}, +                'selec-operation_deletion': {'pks': None},              }          )      ] @@ -2844,7 +2850,7 @@ class OperationWizardDeleteTest(OperationWizardCreationTest):          self.ope = self.get_default_operation(force=True)          self.ope.parcels.add(self.create_parcel()[0])          self.parcel_nb = models.Parcel.objects.count() -        self.form_datas[0].form_datas['selec-operation_deletion']['pk'] = \ +        self.form_datas[0].form_datas['selec-operation_deletion']['pks'] = \              self.ope.pk          self.operation_number = models.Operation.objects.count()          super(OperationWizardDeleteTest, self).pre_wizard() @@ -2861,6 +2867,7 @@ class OperationWizardClosingTest(OperationWizardCreationTest):      url_name = 'operation_closing'      wizard_name = 'operation_closing_wizard'      steps = views.operation_closing_steps +    redirect_url = "/operation_closing/done"      form_datas = [          FormData(              "Wizard closing test", @@ -3107,7 +3114,8 @@ class DocumentTest(OperationInitTest, TestCase):          response = c.post(url, posted)          self.assertEqual(nb_doc + 1, models.Document.objects.count())          self.assertEqual(nb_doc_ope + 1, self.operation.documents.count()) -        self.assertRedirects(response, '/display-document/{}/'.format( +        self.assertRedirects( +            response, '/document/edit/?open_item={}'.format(              self.operation.documents.order_by('-pk').all()[0].pk          )) @@ -3135,7 +3143,7 @@ class DocumentTest(OperationInitTest, TestCase):          posted["operations"] = [str(self.operation.pk)]          response = c.post(url, posted)          self.assertRedirects( -            response, '/display-document/{}/'.format(doc.pk)) +            response, '/document/edit/?open_item={}'.format(doc.pk))          response = c.get('/show-document/{}/'.format(doc.pk))          self.assertIn(posted["title"], response.content.decode()) @@ -3145,12 +3153,13 @@ class DocumentWizardDeleteTest(WizardTest, OperationInitTest, TestCase):      url_name = 'document_deletion'      url_uri = "document/delete"      wizard_name = 'document_deletion_wizard' +    redirect_url = "/{}/selec-{}".format(url_uri, url_name)      steps = document_deletion_steps      form_datas = [          FormData(              "Delete document",              form_datas={ -                'selec': {'pk': None}, +                'selec': {'pks': None},              },          ),      ] @@ -3160,7 +3169,7 @@ class DocumentWizardDeleteTest(WizardTest, OperationInitTest, TestCase):          document = Document.objects.create(title="testy")          document.operations.add(ope)          self.ope_id = ope.pk -        self.form_datas[0].set('selec', 'pk', document.pk) +        self.form_datas[0].set('selec', 'pks', document.pk)          self.doc_nb = Document.objects.count()          super(DocumentWizardDeleteTest, self).pre_wizard() | 
