From 97fa444123827f66390f1d29b18a3544a37242e5 Mon Sep 17 00:00:00 2001
From: Valentin Deniaud <vdeniaud@entrouvert.com>
Date: Tue, 3 Aug 2021 14:02:10 +0200
Subject: [PATCH 4/4] api: rename recurring events views (#55367)

---
 chrono/api/urls.py          | 12 ++++++------
 tests/api/test_datetimes.py | 10 +++++-----
 tests/api/test_fillslot.py  |  6 +++---
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/chrono/api/urls.py b/chrono/api/urls.py
index af9087d..7c5a528 100644
--- a/chrono/api/urls.py
+++ b/chrono/api/urls.py
@@ -22,11 +22,6 @@ urlpatterns = [
     url(r'^agenda/$', views.agendas),
     url(r'^agenda/(?P<agenda_identifier>[\w-]+)/$', views.agenda_detail),
     url(r'^agenda/(?P<agenda_identifier>[\w-]+)/datetimes/$', views.datetimes, name='api-agenda-datetimes'),
-    url(
-        r'^agenda/(?P<agenda_identifier>[\w-]+)/recurring_events/$',
-        views.recurring_events_list,
-        name='api-agenda-recurring-events',
-    ),
     url(
         r'^agenda/(?P<agenda_identifier>[\w-]+)/fillslot/(?P<event_identifier>[\w:-]+)/$',
         views.fillslot,
@@ -39,7 +34,12 @@ urlpatterns = [
         name='api-agenda-events-fillslots',
     ),
     url(
-        r'^agenda/(?P<agenda_identifier>[\w-]+)/recurring_fillslots/$',
+        r'^agenda/(?P<agenda_identifier>[\w-]+)/recurring-events/$',
+        views.recurring_events_list,
+        name='api-agenda-recurring-events',
+    ),
+    url(
+        r'^agenda/(?P<agenda_identifier>[\w-]+)/recurring-events/fillslots/$',
         views.recurring_fillslots,
         name='api-recurring-fillslots',
     ),
diff --git a/tests/api/test_datetimes.py b/tests/api/test_datetimes.py
index 0053e6d..5da4e30 100644
--- a/tests/api/test_datetimes.py
+++ b/tests/api/test_datetimes.py
@@ -1296,10 +1296,10 @@ def test_recurring_events_api_list(app, freezer):
         agenda=agenda,
     )
 
-    resp = app.get('/api/agenda/xxx/recurring_events/', status=404)
+    resp = app.get('/api/agenda/xxx/recurring-events/', status=404)
 
     # recurring events without recurrence_end_date are not bookable
-    resp = app.get('/api/agenda/%s/recurring_events/' % agenda.slug)
+    resp = app.get('/api/agenda/%s/recurring-events/' % agenda.slug)
     assert len(resp.json['data']) == 0
 
     event.recurrence_end_date = now() + datetime.timedelta(days=30)
@@ -1314,7 +1314,7 @@ def test_recurring_events_api_list(app, freezer):
         recurrence_end_date=now() + datetime.timedelta(days=45),
     )
 
-    resp = app.get('/api/agenda/%s/recurring_events/' % agenda.slug)
+    resp = app.get('/api/agenda/%s/recurring-events/' % agenda.slug)
     assert len(resp.json['data']) == 4
     assert resp.json['data'][0]['id'] == 'example-event:0'
     assert resp.json['data'][0]['text'] == 'Monday: Example Event'
@@ -1327,9 +1327,9 @@ def test_recurring_events_api_list(app, freezer):
 
     event.publication_date = now() + datetime.timedelta(days=2)
     event.save()
-    resp = app.get('/api/agenda/%s/recurring_events/' % agenda.slug)
+    resp = app.get('/api/agenda/%s/recurring-events/' % agenda.slug)
     assert len(resp.json['data']) == 1
 
     freezer.move_to(event.recurrence_end_date)
-    resp = app.get('/api/agenda/%s/recurring_events/' % agenda.slug)
+    resp = app.get('/api/agenda/%s/recurring-events/' % agenda.slug)
     assert len(resp.json['data']) == 1
diff --git a/tests/api/test_fillslot.py b/tests/api/test_fillslot.py
index 92ec715..936cb9a 100644
--- a/tests/api/test_fillslot.py
+++ b/tests/api/test_fillslot.py
@@ -2128,11 +2128,11 @@ def test_recurring_events_api_fillslots(app, user, freezer):
     )
     sunday_event.create_all_recurrences()
 
-    resp = app.get('/api/agenda/%s/recurring_events/' % agenda.slug)
+    resp = app.get('/api/agenda/%s/recurring-events/' % agenda.slug)
     assert len(resp.json['data']) == 5
 
     app.authorization = ('Basic', ('john.doe', 'password'))
-    fillslots_url = '/api/agenda/%s/recurring_fillslots/' % agenda.slug
+    fillslots_url = '/api/agenda/%s/recurring-events/fillslots/' % agenda.slug
     params = {'user_external_id': 'user_id'}
     # Book Monday and Thursday of first event and Sunday of second event
     params['slots'] = 'event:0,event:3,sunday-event:6'
@@ -2221,7 +2221,7 @@ def test_recurring_events_api_fillslots_waiting_list(app, user, freezer):
 
     # check that new bookings are put in waiting list despite free slots on main list
     params = {'user_external_id': 'user_id', 'slots': 'event:0'}
-    resp = app.post_json('/api/agenda/%s/recurring_fillslots/' % agenda.slug, params=params)
+    resp = app.post_json('/api/agenda/%s/recurring-events/fillslots/' % agenda.slug, params=params)
     assert resp.json['booking_count'] == 5
     assert events.filter(waiting_list_count=2).count() == 5
 
-- 
2.20.1

