From 8bd67b2c17199c153274316decc9747e34567f81 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 15 Jan 2020 17:47:55 -0500 Subject: [PATCH] Add tests for browsable API endpoints --- netbox/circuits/tests/test_api.py | 9 ++++++++- netbox/dcim/tests/test_api.py | 9 ++++++++- netbox/extras/tests/test_api.py | 9 ++++++++- netbox/ipam/tests/test_api.py | 9 ++++++++- netbox/secrets/tests/test_api.py | 9 ++++++++- netbox/tenancy/tests/test_api.py | 9 ++++++++- netbox/virtualization/tests/test_api.py | 9 ++++++++- 7 files changed, 56 insertions(+), 7 deletions(-) diff --git a/netbox/circuits/tests/test_api.py b/netbox/circuits/tests/test_api.py index 42d534274..b1b6d9e14 100644 --- a/netbox/circuits/tests/test_api.py +++ b/netbox/circuits/tests/test_api.py @@ -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): diff --git a/netbox/dcim/tests/test_api.py b/netbox/dcim/tests/test_api.py index 13d3a48f2..a515df13c 100644 --- a/netbox/dcim/tests/test_api.py +++ b/netbox/dcim/tests/test_api.py @@ -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): diff --git a/netbox/extras/tests/test_api.py b/netbox/extras/tests/test_api.py index 40579f631..b15553a49 100644 --- a/netbox/extras/tests/test_api.py +++ b/netbox/extras/tests/test_api.py @@ -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): diff --git a/netbox/ipam/tests/test_api.py b/netbox/ipam/tests/test_api.py index 22fb71501..4d16d3ad9 100644 --- a/netbox/ipam/tests/test_api.py +++ b/netbox/ipam/tests/test_api.py @@ -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): diff --git a/netbox/secrets/tests/test_api.py b/netbox/secrets/tests/test_api.py index a8721ac87..cabc340f9 100644 --- a/netbox/secrets/tests/test_api.py +++ b/netbox/secrets/tests/test_api.py @@ -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): diff --git a/netbox/tenancy/tests/test_api.py b/netbox/tenancy/tests/test_api.py index 9d4b83484..495cb250d 100644 --- a/netbox/tenancy/tests/test_api.py +++ b/netbox/tenancy/tests/test_api.py @@ -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): diff --git a/netbox/virtualization/tests/test_api.py b/netbox/virtualization/tests/test_api.py index ad9063417..76f6c9d12 100644 --- a/netbox/virtualization/tests/test_api.py +++ b/netbox/virtualization/tests/test_api.py @@ -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):