diff options
Diffstat (limited to 'archaeological_finds')
| -rw-r--r-- | archaeological_finds/tests.py | 27 | 
1 files changed, 19 insertions, 8 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 51bb516ea..3aa0f6ea0 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -297,11 +297,12 @@ class FindTest(FindInit, TestCase):      def setUp(self):          self.create_finds(force=True) -        password = 'mypassword' -        my_admin = User.objects.create_superuser( -            'myuser', 'myemail@test.com', password) +        self.password = 'mypassword' +        self.username = 'myuser' +        User.objects.create_superuser(self.username, 'myemail@test.com', +                                      self.password)          self.client = Client() -        self.client.login(username=my_admin.username, password=password) +        self.client.login(username=self.username, password=self.password)      def testExternalID(self):          find = self.finds[0] @@ -379,12 +380,22 @@ class FindTest(FindInit, TestCase):          self.assertEqual(find_3b.index, 2)          self.assertEqual(bf_3b.index, 2) -    def testShowFind(self): -        find = self.finds[0] -        response = self.client.get(reverse('display-find', args=[find.pk])) +    def test_show(self): +        obj = self.finds[0] +        response = self.client.get(reverse('display-find', args=[obj.pk]))          self.assertEqual(response.status_code, 200) -        self.assertIn('load_window("/show-find/{}/");'.format(find.pk), +        self.assertIn('load_window("/show-find/{}/");'.format(obj.pk),                        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, "") + +        c.login(username=self.username, password=self.password) +        response = self.client.get(reverse('show-find', kwargs={'pk': obj.pk})) +        self.assertEqual(response.status_code, 200) +        self.assertIn('class="sheet"', response.content)  class FindSearchTest(FindInit, TestCase):  | 
