diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-02-04 13:17:26 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-02-04 13:17:26 +0100 | 
| commit | 529488603a97c5eb1d1506bc31096cc0a772d22f (patch) | |
| tree | f09bccf3974b6cbe7316c73795e11d7c11cbdb45 /ishtar_common/tests.py | |
| parent | d3501173e02d9e7d4f63da5b47d56a8878a3bbd3 (diff) | |
| download | Ishtar-529488603a97c5eb1d1506bc31096cc0a772d22f.tar.bz2 Ishtar-529488603a97c5eb1d1506bc31096cc0a772d22f.zip | |
Importers: importer model is now a real DB type - add field to manage created model restriction
Diffstat (limited to 'ishtar_common/tests.py')
| -rw-r--r-- | ishtar_common/tests.py | 19 | 
1 files changed, 11 insertions, 8 deletions
| diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 0082624d7..b57ff0a94 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -271,10 +271,12 @@ class AdminGenTypeTest(TestCase):                  '../ishtar_common/fixtures/initial_importtypes-fr.json',                  settings.ROOT_PATH +                  '../archaeological_operations/fixtures/initial_data-fr.json'] -    models = [models.OrganizationType, models.PersonType, models.TitleType, +    gen_models = [models.OrganizationType, models.PersonType, models.TitleType,                models.AuthorType, models.SourceType, models.OperationType,                models.SpatialReferenceSystem]      # models.Format, models.SupportType -- need fixtures +    models_with_data = gen_models  # + [models.ImporterModel] +    models = models_with_data      module_name = 'ishtar_common'      def setUp(self): @@ -294,14 +296,15 @@ class AdminGenTypeTest(TestCase):              self.assertEqual(                  response.status_code, 200,                  msg="Can not access admin list for {}.".format(model)) -            url = base_url + "{}/".format(model.objects.all()[0].pk) -            response = self.client.get(url) -            self.assertEqual( -                response.status_code, 200, -                msg="Can not access admin detail for {}.".format(model)) +            if model in self.models_with_data: +                url = base_url + "{}/".format(model.objects.all()[0].pk) +                response = self.client.get(url) +                self.assertEqual( +                    response.status_code, 200, +                    msg="Can not access admin detail for {}.".format(model))      def test_csv_export(self): -        for model in self.models: +        for model in self.gen_models:              url = '/admin/{}/{}/'.format(self.module_name,                                           model.__name__.lower())              response = self.client.post(url, {'action': 'export_as_csv'}) @@ -311,7 +314,7 @@ class AdminGenTypeTest(TestCase):      def test_str(self):          # test __str__ -        for model in self.models: +        for model in self.models_with_data:              self.assertTrue(str(model.objects.all()[0])) | 
