Changes users URLs to plural form to match the rest of the app.

This commit is contained in:
Christopher Charbonneau Wells 2017-12-11 17:25:25 -05:00
parent 9796452da7
commit 53a35f3f89
3 changed files with 11 additions and 11 deletions

View File

@ -67,18 +67,18 @@ class FormsTestCase(TestCase):
'password2': 'password' 'password2': 'password'
} }
page = self.c.post('/user/add/', params) page = self.c.post('/users/add/', params)
self.assertEqual(page.status_code, 302) self.assertEqual(page.status_code, 302)
new_user = User.objects.get(username='username') new_user = User.objects.get(username='username')
self.assertIsInstance(new_user, User) self.assertIsInstance(new_user, User)
params['first_name'] = 'Changed' params['first_name'] = 'Changed'
page = self.c.post('/user/{}/'.format(new_user.id), params) page = self.c.post('/users/{}/edit'.format(new_user.id), params)
self.assertEqual(page.status_code, 302) self.assertEqual(page.status_code, 302)
new_user.refresh_from_db() new_user.refresh_from_db()
self.assertEqual(new_user.first_name, params['first_name']) self.assertEqual(new_user.first_name, params['first_name'])
page = self.c.post('/user/{}/delete/'.format(new_user.id)) page = self.c.post('/users/{}/delete/'.format(new_user.id))
self.assertEqual(page.status_code, 302) self.assertEqual(page.status_code, 302)
self.assertQuerysetEqual(User.objects.filter(username='username'), []) self.assertQuerysetEqual(User.objects.filter(username='username'), [])

View File

@ -62,15 +62,15 @@ class ViewsTestCase(TestCase):
self.assertEqual(page.status_code, 200) self.assertEqual(page.status_code, 200)
def test_user_views(self): def test_user_views(self):
page = self.c.get('/user/list/') page = self.c.get('/users/')
self.assertEqual(page.status_code, 200) self.assertEqual(page.status_code, 200)
page = self.c.get('/user/add/') page = self.c.get('/users/add/')
self.assertEqual(page.status_code, 200) self.assertEqual(page.status_code, 200)
entry = User.objects.first() entry = User.objects.first()
page = self.c.get('/user/{}/'.format(entry.id)) page = self.c.get('/users/{}/edit'.format(entry.id))
self.assertEqual(page.status_code, 200) self.assertEqual(page.status_code, 200)
page = self.c.get('/user/{}/delete/'.format(entry.id)) page = self.c.get('/users/{}/delete/'.format(entry.id))
self.assertEqual(page.status_code, 200) self.assertEqual(page.status_code, 200)
def test_welcome(self): def test_welcome(self):

View File

@ -18,11 +18,11 @@ app_patterns = [
url(r'^$', views.RootRouter.as_view(), name='root-router'), url(r'^$', views.RootRouter.as_view(), name='root-router'),
url(r'^welcome/$', views.Welcome.as_view(), name='welcome'), url(r'^welcome/$', views.Welcome.as_view(), name='welcome'),
url(r'^user/list/$', views.UserList.as_view(), name='user-list'), url(r'^users/$', views.UserList.as_view(), name='user-list'),
url(r'^user/add/$', views.UserAdd.as_view(), name='user-add'), url(r'^users/add/$', views.UserAdd.as_view(), name='user-add'),
url(r'^user/(?P<pk>[0-9]+)/$', views.UserUpdate.as_view(), url(r'^users/(?P<pk>[0-9]+)/edit$', views.UserUpdate.as_view(),
name='user-update'), name='user-update'),
url(r'^user/(?P<pk>[0-9]+)/delete/$', views.UserDelete.as_view(), url(r'^users/(?P<pk>[0-9]+)/delete/$', views.UserDelete.as_view(),
name='user-delete'), name='user-delete'),
url(r'^user/password/$', views.UserPassword.as_view(), url(r'^user/password/$', views.UserPassword.as_view(),