c3lf-system-3/core/inventory/tests/test_api.py

35 lines
1.1 KiB
Python
Raw Normal View History

from django.test import TestCase, Client
client = Client()
class ApiTest(TestCase):
def test_root(self):
from core.settings import SYSTEM3_VERSION
2023-11-18 23:13:29 +00:00
response = client.get('/api/')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json()["framework_version"], SYSTEM3_VERSION)
def test_events(self):
2023-11-18 23:13:29 +00:00
response = client.get('/api/1/events/')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), [])
def test_containers(self):
2023-11-18 23:13:29 +00:00
response = client.get('/api/1/boxes/')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), [])
def test_files(self):
2023-11-18 23:13:29 +00:00
response = client.get('/api/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')
2023-11-18 23:13:29 +00:00
response = client.get('/api/1/TEST1/items/')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), [])