Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
gannetson committed Nov 24, 2021
1 parent ed9f169 commit 02e59d5
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion bluebottle/bb_accounts/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
OrganizationFactory, OrganizationContactFactory
)
from bluebottle.test.factory_models.geo import CountryFactory, PlaceFactory
from bluebottle.test.utils import BluebottleTestCase
from bluebottle.test.utils import BluebottleTestCase, APITestCase

ASSERTION_MAPPING = {
'assertion_mapping': {
Expand Down Expand Up @@ -754,3 +754,22 @@ def test_token_expired(self):
data={'user_id': self.user.pk, 'token': token}
)
self.assertEqual(response.status_code, 404)


class MemberDetailViewAPITestCase(APITestCase):
def setUp(self):
super().setUp()
self.user1 = BlueBottleUserFactory()
self.user2 = BlueBottleUserFactory()
self.model = self.user1
self.url = reverse('member-detail', args=(self.user1.id,))

def test_get_current_user(self):
self.perform_get(user=self.user1)
self.assertStatus(status.HTTP_200_OK)
self.assertEqual(self.response.data['id'], self.user1.id)

def test_get_other_user(self):
self.perform_get(user=self.user2)
self.assertStatus(status.HTTP_200_OK)
self.assertEqual(self.response.data['id'], self.user1.id)

0 comments on commit 02e59d5

Please sign in to comment.