summaryrefslogtreecommitdiff
path: root/ishtar_common/tests.py
diff options
context:
space:
mode:
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
commit527c94d6ad95403fc65ca62b9dcb87e3ea3781d1 (patch)
treef09bccf3974b6cbe7316c73795e11d7c11cbdb45 /ishtar_common/tests.py
parent6d59f0d43094bfae59a36dacfd6806b5a6a0b572 (diff)
downloadIshtar-527c94d6ad95403fc65ca62b9dcb87e3ea3781d1.tar.bz2
Ishtar-527c94d6ad95403fc65ca62b9dcb87e3ea3781d1.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.py19
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]))