diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 17:59:34 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 17:59:34 +0200 |
commit | c8f19ffca144e3e940bd0b878bf82f70192780e8 (patch) | |
tree | 293c3ed8ef3776251c5eeb64e04ad426eb361851 /archaeological_finds/tests.py | |
parent | 3728ddd681c428abf2a686b8b31f6cc95c5972cc (diff) | |
download | Ishtar-c8f19ffca144e3e940bd0b878bf82f70192780e8.tar.bz2 Ishtar-c8f19ffca144e3e940bd0b878bf82f70192780e8.zip |
Fix find test
Diffstat (limited to 'archaeological_finds/tests.py')
-rw-r--r-- | archaeological_finds/tests.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index a4a1ad471..c62922499 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -459,9 +459,8 @@ class FindTest(FindInit, TestCase): response.content) c = Client() response = c.get(reverse('show-find', kwargs={'pk': obj.pk})) - self.assertEqual(response.status_code, 200) # empty content when not allowed - self.assertEqual(response.content, "") + self.assertRedirects(response, "/") c.login(username=self.username, password=self.password) response = self.client.get(reverse('show-find', kwargs={'pk': obj.pk})) @@ -508,8 +507,8 @@ class FindSearchTest(FindInit, TestCase): # no result when no authentication response = c.get(reverse('get-find'), search) - self.assertEqual(response.status_code, 200) - self.assertTrue(not json.loads(response.content)) + self.assertRedirects(response, "/") + c.login(username=self.username, password=self.password) # one result for exact search @@ -569,8 +568,7 @@ class FindSearchTest(FindInit, TestCase): # no result when no authentication response = c.get(reverse('get-find'), search) - self.assertEqual(response.status_code, 200) - self.assertTrue(not json.loads(response.content)) + self.assertRedirects(response, "/") # one result for exact search c.login(username=self.username, password=self.password) @@ -612,8 +610,8 @@ class FindSearchTest(FindInit, TestCase): # no result when no authentication response = c.get(reverse('get-find'), search) - self.assertEqual(response.status_code, 200) - self.assertTrue(not json.loads(response.content)) + self.assertRedirects(response, "/") + c.login(username=self.username, password=self.password) # one result for exact search @@ -706,7 +704,8 @@ class FindPermissionTest(FindInit, TestCase): # no result when no authentification c = Client() response = c.get(reverse('get-find')) - self.assertTrue(not json.loads(response.content)) + self.assertTrue(not response.content or + not json.loads(response.content)) # possession c = Client() |