|
|
@@ -55,16 +55,16 @@ class BoardPrivacyTests(APITestCase): |
|
|
|
|
|
|
|
def test_should_non_owner_and_anonymous_user_has_no_permission_to_list_private_board(self): |
|
|
|
resp = self.client.get(self.boards_url) |
|
|
|
self.assertEqual(len(resp.data), 0, resp.data) |
|
|
|
self.assertEqual(len(resp.json()), 0, resp.json()) |
|
|
|
|
|
|
|
self.client.login(username=self.non_owner.username, password='password') |
|
|
|
resp = self.client.get(self.boards_url) |
|
|
|
self.assertEqual(len(resp.data), 0, resp.data) |
|
|
|
self.assertEqual(len(resp.json()), 0, resp.content) |
|
|
|
|
|
|
|
def test_should_owner_has_permission_to_list_private_board(self): |
|
|
|
self.client.login(username=self.non_owner.username, password='password') |
|
|
|
resp = self.client.get(self.boards_url) |
|
|
|
self.assertEqual(len(resp.data), 0, resp.data) |
|
|
|
self.assertEqual(len(resp.json()), 0, resp.content) |
|
|
|
|
|
|
|
def test_should_non_owner_and_anonymous_user_has_no_permission_to_view_private_board(self): |
|
|
|
resp = self.client.get(self.board_url) |
|
|
@@ -106,35 +106,35 @@ class PinPrivacyTests(APITestCase): |
|
|
|
|
|
|
|
def test_should_non_owner_and_anonymous_user_has_no_permission_to_list_private_pin(self): |
|
|
|
resp = self.client.get(reverse("pin-list")) |
|
|
|
self.assertEqual(len(resp.data['results']), 0, resp.data) |
|
|
|
self.assertEqual(len(resp.json()['results']), 0, resp.content) |
|
|
|
|
|
|
|
self.client.login(username=self.non_owner.username, password='password') |
|
|
|
resp = self.client.get(reverse("pin-list")) |
|
|
|
self.assertEqual(len(resp.data['results']), 0, resp.data) |
|
|
|
self.assertEqual(len(resp.json()['results']), 0, resp.content) |
|
|
|
|
|
|
|
def test_should_non_owner_and_anonymous_user_has_no_permission_to_list_private_pin_in_board(self): |
|
|
|
resp = self.client.get(self.board_url) |
|
|
|
self.assertEqual(len(resp.data['pins_detail']), 0, resp.data) |
|
|
|
self.assertEqual(len(resp.json()['pins_detail']), 0, resp.content) |
|
|
|
self.client.login(username=self.non_owner.username, password='password') |
|
|
|
|
|
|
|
resp = self.client.get(self.board_url) |
|
|
|
self.assertEqual(len(resp.data['pins_detail']), 0, resp.data) |
|
|
|
self.assertEqual(len(resp.json()['pins_detail']), 0, resp.content) |
|
|
|
|
|
|
|
def test_should_owner_user_has_permission_to_list_private_pin_in_board(self): |
|
|
|
self.client.login(username=self.owner.username, password='password') |
|
|
|
resp = self.client.get(self.board_url) |
|
|
|
self.assertEqual(len(resp.data['pins_detail']), 1, resp.data) |
|
|
|
self.assertEqual(len(resp.json()['pins_detail']), 1, resp.content) |
|
|
|
|
|
|
|
def test_should_owner_user_has_permission_to_list_private_pin(self): |
|
|
|
self.client.login(username=self.owner.username, password='password') |
|
|
|
resp = self.client.get(reverse("pin-list")) |
|
|
|
self.assertEqual(len(resp.data['results']), 1, resp.data) |
|
|
|
self.assertEqual(len(resp.json()['results']), 1, resp.content) |
|
|
|
|
|
|
|
def test_should_owner_has_permission_to_view_private_pin(self): |
|
|
|
self.client.login(username=self.owner.username, password='password') |
|
|
|
resp = self.client.get(self.private_pin_url) |
|
|
|
self.assertEqual(resp.status_code, 200) |
|
|
|
self.assertEqual(resp.data['id'], self.private_pin.id) |
|
|
|
self.assertEqual(resp.json()['id'], self.private_pin.id) |
|
|
|
|
|
|
|
def test_should_anonymous_user_has_no_permission_to_view_private_pin(self): |
|
|
|
resp = self.client.get(self.private_pin_url) |
|
|
|