35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
|
from django.test import TestCase, Client
|
||
|
|
||
|
client = Client()
|
||
|
|
||
|
|
||
|
class ApiTest(TestCase):
|
||
|
|
||
|
def test_root(self):
|
||
|
from core.settings import SYSTEM3_VERSION
|
||
|
response = client.get('/')
|
||
|
self.assertEqual(response.status_code, 200)
|
||
|
self.assertEqual(response.json()["framework_version"], SYSTEM3_VERSION)
|
||
|
|
||
|
def test_events(self):
|
||
|
response = client.get('/1/events/')
|
||
|
self.assertEqual(response.status_code, 200)
|
||
|
self.assertEqual(response.json(), [])
|
||
|
|
||
|
def test_containers(self):
|
||
|
response = client.get('/1/boxes/')
|
||
|
self.assertEqual(response.status_code, 200)
|
||
|
self.assertEqual(response.json(), [])
|
||
|
|
||
|
def test_files(self):
|
||
|
response = client.get('/1/files/')
|
||
|
self.assertEqual(response.status_code, 200)
|
||
|
self.assertEqual(response.json(), [])
|
||
|
|
||
|
def test_items(self):
|
||
|
from inventory.models import Event
|
||
|
Event.objects.create(slug='TEST1', name='Event')
|
||
|
response = client.get('/1/TEST1/items/')
|
||
|
self.assertEqual(response.status_code, 200)
|
||
|
self.assertEqual(response.json(), [])
|