diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-06-30 16:50:58 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-06-30 16:50:58 +0200 |
commit | 72b0a0276e70194666ff9110522f49f4e3f1476e (patch) | |
tree | 6a41f63eabed5f6f3f7537585d5ae3f3a00e4d00 /archaeological_operations/tests.py | |
parent | 9fe30e305e1a114277e8473df415588bfacd188d (diff) | |
parent | 483fcd46fb60a597959bfde9d00bde4cc1822cd2 (diff) | |
download | Ishtar-72b0a0276e70194666ff9110522f49f4e3f1476e.tar.bz2 Ishtar-72b0a0276e70194666ff9110522f49f4e3f1476e.zip |
Merge branch 'master' into v0.9
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r-- | archaeological_operations/tests.py | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 924727065..b2f38801a 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -32,7 +32,7 @@ from archaeological_operations import views from ishtar_common.models import OrganizationType, Organization, ItemKey, \ ImporterType, IshtarUser, TargetKey, ImporterModel, IshtarSiteProfile, \ - Town, ImporterColumn, Person + Town, ImporterColumn, Person, Author, SourceType, AuthorType from archaeological_context_records.models import Unit from ishtar_common import forms_common @@ -1357,3 +1357,51 @@ class OperationAdminActWizardCreationTest(WizardTest, OperationInitTest, def post_wizard(self): self.assertEqual(models.AdministrativeAct.objects.count(), self.number + 1) + + +class OperationSourceWizardModificationTest(WizardTest, OperationInitTest, + TestCase): + fixtures = OperationWizardCreationTest.fixtures + url_name = 'operation_source_modification' + wizard_name = 'operation_source_wizard' + steps = views.operation_source_modification_steps + form_datas = [ + FormData( + "Test remove all authors", + form_datas={ + 'selec-operation_source_modification': {}, + 'source-operation_source_modification': { + 'title': "New title", + 'source_type': None, + 'index': 42 + }, + 'authors-operation_source_modification': [] + }, + ) + ] + + def pre_wizard(self): + ope = self.get_default_operation() + self.source = models.OperationSource.objects.create( + title="Old title", source_type=SourceType.objects.all()[0], + operation=ope + ) + author = Author.objects.create( + author_type=AuthorType.objects.all()[0], + person=Person.objects.all()[0] + ) + + self.source.authors.add(author) + + data = self.form_datas[0].form_datas + data['selec-operation_source_modification']['pk'] = self.source.pk + + data['source-operation_source_modification']['hidden_operation_id'] = \ + self.source.pk + data['source-operation_source_modification'][ + 'source_type'] = SourceType.objects.all()[1].pk + super(OperationSourceWizardModificationTest, self).pre_wizard() + + def post_wizard(self): + source = models.OperationSource.objects.get(pk=self.source.pk) + self.assertEqual(source.authors.count(), 0)
\ No newline at end of file |