Skip to content

Commit 2d51d90

Browse files
committed
(chore) add test for bucketlist ownership
1 parent 4b6f67d commit 2d51d90

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

rest_api/tests.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,19 @@ def test_model_can_create_a_bucketlist(self):
2323
new_count = Bucketlist.objects.count()
2424
self.assertNotEqual(old_count, new_count)
2525

26+
def test_is_owner_enforcement(self):
27+
"""Test that the api has authorization."""
28+
new_user = User.objects.create(username="aaa")
29+
bucketlist = Bucketlist.objects.filter(owner=new_user)
30+
self.assertEquals(bucketlist.count(), 0)
31+
2632
def test_model_returns_readable_representation(self):
2733
"""Test a readable string is returned for the model instance."""
2834
self.assertEqual(str(self.bucketlist), self.name)
2935

3036

37+
38+
3139
class ViewTestCase(TestCase):
3240
"""Test suite for the api views."""
3341

@@ -77,5 +85,4 @@ def test_api_can_delete_bucketlist(self):
7785
reverse('details', kwargs={'pk': bucketlist.id}),
7886
format='json',
7987
follow=True)
80-
8188
self.assertEquals(response.status_code, status.HTTP_204_NO_CONTENT)

0 commit comments

Comments
 (0)