Correct timer urls to use plural form

This commit is contained in:
Christopher C. Wells 2020-02-06 20:14:01 -08:00
parent 6333b0b1ea
commit 005a4f180e
3 changed files with 21 additions and 17 deletions

View File

@ -474,7 +474,7 @@ class TimerFormsTestCase(FormsTestCaseBase):
'name': 'Test Timer',
'start': self.localtime_string()
}
page = self.c.post('/timer/add/', params, follow=True)
page = self.c.post('/timers/add/', params, follow=True)
self.assertEqual(page.status_code, 200)
self.assertContains(page, params['name'])
self.assertContains(page, params['child'])
@ -485,7 +485,7 @@ class TimerFormsTestCase(FormsTestCaseBase):
'name': 'New Timer Name',
'start': self.localtime_string(start_time)
}
page = self.c.post('/timer/{}/edit/'.format(self.timer.id), params,
page = self.c.post('/timers/{}/edit/'.format(self.timer.id), params,
follow=True)
self.assertEqual(page.status_code, 200)
self.assertContains(page, params['name'])
@ -500,7 +500,7 @@ class TimerFormsTestCase(FormsTestCaseBase):
'start': self.localtime_string(self.timer.start),
'end': self.localtime_string(self.timer.end),
}
page = self.c.post('/timer/{}/edit/'.format(self.timer.id), params,
page = self.c.post('/timers/{}/edit/'.format(self.timer.id), params,
follow=True)
self.assertEqual(page.status_code, 200)

View File

@ -112,21 +112,21 @@ class ViewsTestCase(TestCase):
def test_timer_views(self):
page = self.c.get('/timers/')
self.assertEqual(page.status_code, 200)
page = self.c.get('/timer/add/')
page = self.c.get('/timers/add/')
self.assertEqual(page.status_code, 200)
page = self.c.get('/timer/add/quick/')
page = self.c.get('/timers/add/quick/')
self.assertEqual(page.status_code, 302)
entry = models.Timer.objects.first()
page = self.c.get('/timer/{}/'.format(entry.id))
page = self.c.get('/timers/{}/'.format(entry.id))
self.assertEqual(page.status_code, 200)
page = self.c.get('/timer/{}/edit/'.format(entry.id))
page = self.c.get('/timers/{}/edit/'.format(entry.id))
self.assertEqual(page.status_code, 200)
page = self.c.get('/timer/{}/delete/'.format(entry.id))
page = self.c.get('/timers/{}/delete/'.format(entry.id))
self.assertEqual(page.status_code, 200)
page = self.c.get('/timer/{}/stop/'.format(entry.id))
page = self.c.get('/timers/{}/stop/'.format(entry.id))
self.assertEqual(page.status_code, 302)
page = self.c.get('/timer/{}/restart/'.format(entry.id))
page = self.c.get('/timers/{}/restart/'.format(entry.id))
self.assertEqual(page.status_code, 302)
def test_tummytime_views(self):

View File

@ -94,26 +94,30 @@ urlpatterns = [
),
path('timers/', views.TimerList.as_view(), name='timer-list'),
path('timer/add/', views.TimerAdd.as_view(), name='timer-add'),
path('timers/add/', views.TimerAdd.as_view(), name='timer-add'),
path(
'timer/add/quick/',
'timers/add/quick/',
views.TimerAddQuick.as_view(),
name='timer-add-quick'
),
path('timer/<int:pk>/', views.TimerDetail.as_view(), name='timer-detail'),
path('timers/<int:pk>/', views.TimerDetail.as_view(), name='timer-detail'),
path(
'timer/<int:pk>/edit/',
'timers/<int:pk>/edit/',
views.TimerUpdate.as_view(),
name='timer-update'
),
path(
'timer/<int:pk>/delete/',
'timers/<int:pk>/delete/',
views.TimerDelete.as_view(),
name='timer-delete'
),
path('timer/<int:pk>/stop/', views.TimerStop.as_view(), name='timer-stop'),
path(
'timer/<int:pk>/restart/',
'timers/<int:pk>/stop/',
views.TimerStop.as_view(),
name='timer-stop'
),
path(
'timers/<int:pk>/restart/',
views.TimerRestart.as_view(),
name='timer-restart'
),