summaryrefslogtreecommitdiff
path: root/archaeological_finds/tests.py
diff options
context:
space:
mode:
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()