def test_profiles_get(self): view = UserProfileViewSet.as_view({'get': 'retrieve'}) request = self.factory.get('/', **self.extra) response = view(request) self.assertEqual(response.status_code, 400) self.assertEqual(response.data, {'detail': 'Expected URL keyword argument `user`.'}) request = self.factory.get('/', **self.extra) response = view(request, user='******') data = { 'url': 'http://testserver/api/v1/profiles/bob', 'username': u'bob', 'name': u'Bob', 'email': u'*****@*****.**', 'city': u'Bobville', 'country': u'US', 'organization': u'Bob Inc.', 'website': u'bob.com', 'twitter': u'boberama', 'gravatar': self.user.profile.gravatar, 'require_auth': False, 'user': '******' } self.assertEqual(response.status_code, 200) self.assertEqual(response.data, data)
def test_profiles_get(self): view = UserProfileViewSet.as_view({"get": "retrieve"}) request = self.factory.get("/", **self.extra) response = view(request) self.assertEqual(response.status_code, 400) self.assertEqual(response.data, {"detail": "Expected URL keyword argument `user`."}) request = self.factory.get("/", **self.extra) response = view(request, user="******") data = { "url": "http://testserver/api/v1/profiles/bob", "username": u"bob", "name": u"Bob", "email": u"*****@*****.**", "city": u"Bobville", "country": u"US", "organization": u"Bob Inc.", "website": u"bob.com", "twitter": u"boberama", "gravatar": self.user.profile.gravatar, "require_auth": False, "user": "******", } self.assertEqual(response.status_code, 200) self.assertEqual(response.data, data)
def setUp(self): super(TestProfilesAPI, self).setUp() self.view = UserProfileViewSet.as_view({ 'get': 'list', 'post': 'create' })
def setUp(self): super(TestProfilesAPI, self).setUp() self.view = UserProfileViewSet.as_view({"get": "list", "post": "create"})