add /api url prefix in backend
This commit is contained in:
parent
e5bec44164
commit
7369db8512
7 changed files with 55 additions and 46 deletions
|
@ -16,7 +16,7 @@ class FileTestCase(TestCase):
|
|||
def test_list_files(self):
|
||||
import base64
|
||||
item = File.objects.create(data=base64.b64encode(b"foo").decode('utf-8'))
|
||||
response = client.get('/1/files/')
|
||||
response = client.get('/api/1/files/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.json()[0]['hash'], item.hash)
|
||||
self.assertEqual(len(response.json()[0]['hash']), 64)
|
||||
|
@ -24,7 +24,7 @@ class FileTestCase(TestCase):
|
|||
def test_one_file(self):
|
||||
import base64
|
||||
item = File.objects.create(data=base64.b64encode(b"foo").decode('utf-8'))
|
||||
response = client.get(f'/1/file/{item.hash}/')
|
||||
response = client.get(f'/api/1/file/{item.hash}/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.json()['hash'], item.hash)
|
||||
self.assertEqual(len(response.json()['hash']), 64)
|
||||
|
@ -33,7 +33,7 @@ class FileTestCase(TestCase):
|
|||
import base64
|
||||
Item.objects.create(container=self.box, event=self.event, description='1')
|
||||
item = Item.objects.create(container=self.box, event=self.event, description='2')
|
||||
response = client.post('/1/file/', {'data': base64.b64encode(b"foo").decode('utf-8')}, content_type='application/json')
|
||||
response = client.post('/api/1/file/', {'data': base64.b64encode(b"foo").decode('utf-8')}, content_type='application/json')
|
||||
self.assertEqual(response.status_code, 201)
|
||||
self.assertEqual(len(response.json()['hash']), 64)
|
||||
|
||||
|
@ -43,5 +43,5 @@ class FileTestCase(TestCase):
|
|||
File.objects.create(item=item, data=base64.b64encode(b"foo").decode('utf-8'))
|
||||
file = File.objects.create(item=item, data=base64.b64encode(b"bar").decode('utf-8'))
|
||||
self.assertEqual(len(File.objects.all()), 2)
|
||||
response = client.delete(f'/1/file/{file.hash}/')
|
||||
response = client.delete(f'/api/1/file/{file.hash}/')
|
||||
self.assertEqual(response.status_code, 204)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue