Skip to content

Commit

Permalink
Feature(User Profile):Users should be able to create their profiles
Browse files Browse the repository at this point in the history
- Update urls and profile renderer

[Feature #161255357]
  • Loading branch information
AnguleMathias committed Nov 8, 2018
1 parent 90fc3ae commit dcf82dd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions authors/apps/profiles/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def render(self, data, media_type=None, renderer_context=None):

if type(data) != ReturnDict:
return json.dumps({
'profiles': data
'profile': data
})
else:
return json.dumps({
'profiles': data
'profile': data
})
8 changes: 4 additions & 4 deletions authors/apps/profiles/tests/test_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
class ProfilesTest(BaseTest):

def test_list_profiles(self):
response = self.client.get('/profile/', format="json")
response = self.client.get('/profiles/', format="json")
self.assertEqual(response.status_code, status.HTTP_200_OK)

def test_user_view_their_profile(self):
response = self.client.get('/profile/mathias', format="json")
response = self.client.get('/profiles/mathias', format="json")
self.assertEqual(response.status_code, status.HTTP_200_OK)

def test_retrieve_non_existing_profile(self):
response = self.client.get('/profile/angule', format="json")
response = self.client.get('/profiles/angule', format="json")
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)

def test_update_profile(self):
Expand All @@ -25,6 +25,6 @@ def test_update_profile(self):
"avatar": "https://pbs.twimg.com/profile_images/670856248678596608/2yr7o6QQ_400x400.jpg",
"bio": "codeofdutycodeofdutycodeofduty"
}
response = self.client.put('/profile/mathias', data, format="json")
response = self.client.put('/profiles/mathias', data, format="json")
self.assertIn("codeofdutycodeofdutycodeofduty", response.data['bio'])
self.assertEqual(response.status_code, status.HTTP_200_OK)
2 changes: 1 addition & 1 deletion authors/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
path('admin/', admin.site.urls),
path('api/', include(('authors.apps.authentication.urls',
'authentication'), namespace='authentication')),
path('profile/', include('authors.apps.profiles.urls')),
path('profiles/', include(('authors.apps.profiles.urls', 'profiles'), namespace='profiles')),
]

0 comments on commit dcf82dd

Please sign in to comment.