Commit a30d6bc6 authored by Bengfort's avatar Bengfort
Browse files

adapt tests for UUID

parent 3d514e22
......@@ -7,7 +7,7 @@ from .main.models import Schedule
from .main.models import Invitation
class TestInvitationApiView(TestCase):
class TestLegacyInvitationApiView(TestCase):
def setUp(self):
self.client.defaults['HTTP_AUTHORIZATION'] = 'token ' + settings.API_TOKEN
......@@ -30,3 +30,28 @@ class TestInvitationApiView(TestCase):
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
def test_get(self):
invitation = baker.make(Invitation)
url = '/api/{}/{}/'.format(invitation.schedule.uuid, 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.uuid, '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.uuid, invitation.token)
response = self.client.delete(url)
self.assertEqual(response.status_code, 204)
self.assertFalse(Invitation.objects.filter(token=invitation.token).exists())
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