summaryrefslogtreecommitdiff
path: root/archaeological_finds/tests.py
diff options
context:
space:
mode:
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
commit9250bc9babf70b28ba971e5e9d6f0526ceaac2f0 (patch)
tree293c3ed8ef3776251c5eeb64e04ad426eb361851 /archaeological_finds/tests.py
parent4649cf3fcfd901dfd099355a29b664a450966823 (diff)
downloadIshtar-9250bc9babf70b28ba971e5e9d6f0526ceaac2f0.tar.bz2
Ishtar-9250bc9babf70b28ba971e5e9d6f0526ceaac2f0.zip
Fix find test
Diffstat (limited to 'archaeological_finds/tests.py')
-rw-r--r--archaeological_finds/tests.py17
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()