1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Add tests for browsable API endpoints

This commit is contained in:
Jeremy Stretch
2020-01-15 17:47:55 -05:00
parent 4073dedff8
commit 8bd67b2c17
7 changed files with 56 additions and 7 deletions

View File

@ -9,7 +9,14 @@ from extras.models import Graph
from utilities.testing import APITestCase, choices_to_dict
class ChoicesTest(APITestCase):
class AppTest(APITestCase):
def test_root(self):
url = reverse('circuits-api:api-root')
response = self.client.get('{}?format=api'.format(url), **self.header)
self.assertEqual(response.status_code, 200)
def test_choices(self):

View File

@ -18,7 +18,14 @@ from utilities.testing import APITestCase, choices_to_dict
from virtualization.models import Cluster, ClusterType
class ChoicesTest(APITestCase):
class AppTest(APITestCase):
def test_root(self):
url = reverse('dcim-api:api-root')
response = self.client.get('{}?format=api'.format(url), **self.header)
self.assertEqual(response.status_code, 200)
def test_choices(self):

View File

@ -15,7 +15,14 @@ from tenancy.models import Tenant, TenantGroup
from utilities.testing import APITestCase, choices_to_dict
class ChoicesTest(APITestCase):
class AppTest(APITestCase):
def test_root(self):
url = reverse('extras-api:api-root')
response = self.client.get('{}?format=api'.format(url), **self.header)
self.assertEqual(response.status_code, 200)
def test_choices(self):

View File

@ -10,7 +10,14 @@ from ipam.models import Aggregate, IPAddress, Prefix, RIR, Role, Service, VLAN,
from utilities.testing import APITestCase, choices_to_dict
class ChoicesTest(APITestCase):
class AppTest(APITestCase):
def test_root(self):
url = reverse('ipam-api:api-root')
response = self.client.get('{}?format=api'.format(url), **self.header)
self.assertEqual(response.status_code, 200)
def test_choices(self):

View File

@ -9,7 +9,14 @@ from utilities.testing import APITestCase
from .constants import PRIVATE_KEY, PUBLIC_KEY
class ChoicesTest(APITestCase):
class AppTest(APITestCase):
def test_root(self):
url = reverse('secrets-api:api-root')
response = self.client.get('{}?format=api'.format(url), **self.header)
self.assertEqual(response.status_code, 200)
def test_choices(self):

View File

@ -5,7 +5,14 @@ from tenancy.models import Tenant, TenantGroup
from utilities.testing import APITestCase
class ChoicesTest(APITestCase):
class AppTest(APITestCase):
def test_root(self):
url = reverse('tenancy-api:api-root')
response = self.client.get('{}?format=api'.format(url), **self.header)
self.assertEqual(response.status_code, 200)
def test_choices(self):

View File

@ -10,7 +10,14 @@ from virtualization.choices import *
from virtualization.models import Cluster, ClusterGroup, ClusterType, VirtualMachine
class ChoicesTest(APITestCase):
class AppTest(APITestCase):
def test_root(self):
url = reverse('virtualization-api:api-root')
response = self.client.get('{}?format=api'.format(url), **self.header)
self.assertEqual(response.status_code, 200)
def test_choices(self):