Skip to content

Commit

Permalink
chore(reorganize urls): authetication urls
Browse files Browse the repository at this point in the history
- Prefix '/user/' to all authenticaton urls
- Rename user registration url to '/api/user/register/'

[Finishes #164772118]
  • Loading branch information
cob04 committed Mar 21, 2019
1 parent f1b028e commit 7da94b7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
19 changes: 9 additions & 10 deletions authors/apps/authentication/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@
EmailVerificationView, CreateEmailVerificationTokenAPIView,
PasswordResetView)


app_name = 'authentication'


urlpatterns = [
path('user/', UserRetrieveUpdateAPIView.as_view(), name='get users'),
path('users/', RegistrationAPIView.as_view(), name='register'),
path('users/login/', LoginAPIView.as_view(), name='login'),
path('users/oauth/', SocialAuthenticationView.as_view(),
path('', UserRetrieveUpdateAPIView.as_view(), name='get users'),
path('register/', RegistrationAPIView.as_view(), name='register'),
path('login/', LoginAPIView.as_view(), name='login'),
path('oauth/', SocialAuthenticationView.as_view(),
name='social_login'),
path(
'activate/<str:token>',
EmailVerificationView.as_view(), name='verify email'),
path('activate/<str:token>',
EmailVerificationView.as_view(), name='verify email'),
path('token/', CreateEmailVerificationTokenAPIView.as_view(),
name='new verification token'),
path('users/password-reset/', PasswordResetView.as_view(),
path('password-reset/', PasswordResetView.as_view(),
name='password-reset')


]
6 changes: 4 additions & 2 deletions authors/apps/profiles/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def login_a_user(self):
"""

response = self.test_client.post(
"/api/users/login/", data=json.dumps(self.data), content_type='application/json')
reverse("authentication:login"),
data=json.dumps(self.data), content_type='application/json')
token = response.json()['user']['token']
return token

Expand All @@ -92,7 +93,8 @@ def register_user(self, user_details_dict):
Returns: an issued post request to the user registration endpoint
"""
return self.test_client.post(
"/api/users/", data=json.dumps(user_details_dict), content_type='application/json')
reverse("authentication:register"),
data=json.dumps(user_details_dict), content_type='application/json')

def follow_user(self, username, token):
"""This method sends a follow request to a user"""
Expand Down
4 changes: 2 additions & 2 deletions authors/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
namespace='articles')),
path('profiles/', include('authors.apps.profiles.urls',
namespace='profiles')),
path('', include('authors.apps.authentication.urls',
namespace='authentication')),
path('user/', include('authors.apps.authentication.urls',
namespace='authentication')),
]


Expand Down

0 comments on commit 7da94b7

Please sign in to comment.