diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-01-30 15:54:44 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-01-30 15:54:44 +0100 |
commit | 546fabe02e7b602e2e319aa57e9f835cff564846 (patch) | |
tree | d83807593dce8ef9721c3a5ecd33c59c1efd9ff0 | |
parent | bd0b2ee98e76ada212d67e5e14c5e5c6d2650593 (diff) | |
download | Ishtar-546fabe02e7b602e2e319aa57e9f835cff564846.tar.bz2 Ishtar-546fabe02e7b602e2e319aa57e9f835cff564846.zip |
Finds: fix material col in tables
-rw-r--r-- | archaeological_context_records/tests.py | 8 | ||||
-rw-r--r-- | archaeological_finds/models_finds.py | 2 | ||||
-rw-r--r-- | archaeological_finds/tests.py | 10 | ||||
-rw-r--r-- | archaeological_operations/tests.py | 3 |
4 files changed, 17 insertions, 6 deletions
diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index c56964670..87eb80c57 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -231,7 +231,10 @@ class ContextRecordSearchTest(ContextRecordInit, TestCase): c.login(username=self.username, password=self.password) response = c.get(reverse('get-contextrecord'), search) self.assertEqual(response.status_code, 200) - self.assertEqual(json.loads(response.content)['total'], 1) + res = json.loads(response.content) + self.assertTrue(res['total'] == 1) + self.assertEqual(res["rows"][0]["unit"], + unicode(dig)) # no result for the brother search = {'unit': dest.pk} @@ -268,7 +271,8 @@ class ContextRecordSearchTest(ContextRecordInit, TestCase): c.login(username=self.username, password=self.password) response = c.get(reverse('get-contextrecord'), search) self.assertEqual(response.status_code, 200) - self.assertEqual(json.loads(response.content)['total'], 1) + res = json.loads(response.content) + self.assertTrue(res['total'] == 1) # no result for the brother search = {'datings__period': recent_neo.pk} diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 651559426..bbb74e4f3 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -308,7 +308,7 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): CHECK_DICT = dict(CHECK_CHOICES) SHOW_URL = 'show-find' SLUG = 'find' - TABLE_COLS = ['label', 'material_types', 'datings__period__label', + TABLE_COLS = ['label', 'material_types__label', 'datings__period__label', 'base_finds__context_record__parcel__town', 'base_finds__context_record__operation__year', 'base_finds__context_record__operation__operation_code', diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 34f95cf7d..f0112123b 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -367,7 +367,10 @@ class FindSearchTest(FindInit, TestCase): # one result for exact search response = c.get(reverse('get-find'), search) self.assertEqual(response.status_code, 200) - self.assertTrue(json.loads(response.content)['total'] == 1) + res = json.loads(response.content) + self.assertTrue(res['total'] == 1) + self.assertEqual(res["rows"][0]["material_types__label"], + unicode(iron_metal)) # no result for the brother search = {'material_types': not_iron_metal.pk} @@ -404,7 +407,10 @@ class FindSearchTest(FindInit, TestCase): c.login(username=self.username, password=self.password) response = c.get(reverse('get-find'), search) self.assertEqual(response.status_code, 200) - self.assertEqual(json.loads(response.content)['total'], 1) + res = json.loads(response.content) + self.assertTrue(res['total'] == 1) + self.assertEqual(res["rows"][0]["datings__period__label"], + unicode(final_neo)) # no result for the brother search = {'datings__period': recent_neo.pk} diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index ba7722d84..d4134693f 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -689,7 +689,8 @@ class OperationSearchTest(TestCase, OperationInitTest): # one result for exact search response = c.get(reverse('get-operation'), search) self.assertEqual(response.status_code, 200) - self.assertEqual(json.loads(response.content)['total'], 1) + res = json.loads(response.content) + self.assertTrue(res['total'] == 1) # no result for the brother search = {'periods': recent_neo.pk} |