Commit 15aa288e authored by Hayat's avatar Hayat
Browse files

Merge branch 'rm-legacy-views' into 'main'

remove legacy views

See merge request !21
parents 5d4f8ceb 864271ce
Pipeline #10769 passed with stages
in 2 minutes and 6 seconds
......@@ -70,10 +70,10 @@ described above.
Example:
```sh
$ curl -X PUT -H 'Authorization: token CHANGEME' http://localhost:8001/api/1/foo/
$ curl -X GET -H 'Authorization: token CHANGEME' http://localhost:8001/api/1/foo/
$ curl -X PUT -H 'Authorization: token CHANGEME' http://localhost:8001/api/26f4c524-4c74-4788-90c6-889dff86001d/foo/
$ curl -X GET -H 'Authorization: token CHANGEME' http://localhost:8001/api/26f4c524-4c74-4788-90c6-889dff86001d/foo/
{"datetime": "2020-11-03T07:00:00"}
$ curl -X DELETE -H 'Authorization: token CHANGEME' http://localhost:8001/api/1/foo/
$ curl -X DELETE -H 'Authorization: token CHANGEME' http://localhost:8001/api/26f4c524-4c74-4788-90c6-889dff86001d/foo/
```
[1]: https://www.mpib-berlin.mpg.de/research-data/castellum
......
......@@ -7,31 +7,6 @@ from .main.models import Schedule
from .main.models import Invitation
class TestLegacyInvitationApiView(TestCase):
def setUp(self):
self.client.defaults['HTTP_AUTHORIZATION'] = 'token ' + settings.API_TOKEN
def test_get(self):
invitation = baker.make(Invitation)
url = '/api/{}/{}/'.format(invitation.schedule.id, invitation.token)
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
def test_put(self):
schedule = baker.make(Schedule)
url = '/api/{}/{}/'.format(schedule.id, 'sometoken')
response = self.client.put(url)
self.assertEqual(response.status_code, 204)
self.assertTrue(Invitation.objects.filter(token='sometoken').exists())
def test_delete(self):
invitation = baker.make(Invitation)
url = '/api/{}/{}/'.format(invitation.schedule.id, invitation.token)
response = self.client.delete(url)
self.assertEqual(response.status_code, 204)
self.assertFalse(Invitation.objects.filter(token=invitation.token).exists())
class TestInvitationApiView(TestCase):
def setUp(self):
self.client.defaults['HTTP_AUTHORIZATION'] = 'token ' + settings.API_TOKEN
......
......@@ -35,25 +35,13 @@ from .main.views import ScheduleUpdateView
urlpatterns = [
path('', ScheduleListView.as_view(), name='index'),
path('new/', ScheduleCreateView.as_view(), name='schedule-create'),
path('<int:pk>/', ScheduleUpdateView.as_view(), name='schedule-update-legacy'),
path('<uuid:uuid>/', ScheduleUpdateView.as_view(), name='schedule-update'),
path('<int:pk>/delete/', ScheduleDeleteView.as_view(), name='schedule-delete-legacy'),
path('<uuid:uuid>/delete/', ScheduleDeleteView.as_view(), name='schedule-delete'),
path(
'invitations/<int:schedule_id>/<token>/',
InvitationUpdateView.as_view(),
name='invitation-legacy',
),
path(
'invitations/<uuid:schedule__uuid>/<token>/',
InvitationUpdateView.as_view(),
name='invitation',
),
path(
'api/<int:schedule_id>/<token>/',
InvitationApiView.as_view(),
name='api-invitation-legacy',
),
path(
'api/<uuid:schedule__uuid>/<token>/',
InvitationApiView.as_view(),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment