From 6449b57f6d95117b8597d54995ba00b89bf9734d Mon Sep 17 00:00:00 2001 From: Arthur Date: Wed, 22 Mar 2023 11:15:10 -0700 Subject: [PATCH] 9608 re-add schema test --- netbox/utilities/tests/test_api.py | 42 +++++++++++++++--------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/netbox/utilities/tests/test_api.py b/netbox/utilities/tests/test_api.py index ccd381a38..1cc3487b1 100644 --- a/netbox/utilities/tests/test_api.py +++ b/netbox/utilities/tests/test_api.py @@ -234,24 +234,24 @@ class APIOrderingTestCase(APITestCase): ) -# class APIDocsTestCase(TestCase): -# -# def setUp(self): -# self.client = Client() -# -# # Populate a CustomField to activate CustomFieldSerializer -# content_type = ContentType.objects.get_for_model(Site) -# self.cf_text = CustomField(type=CustomFieldTypeChoices.TYPE_TEXT, name='test') -# self.cf_text.save() -# self.cf_text.content_types.set([content_type]) -# self.cf_text.save() -# -# def test_api_docs(self): -# -# url = reverse('api_docs') -# params = { -# "format": "openapi", -# } -# -# response = self.client.get('{}?{}'.format(url, urllib.parse.urlencode(params))) -# self.assertEqual(response.status_code, 200) +class APIDocsTestCase(TestCase): + + def setUp(self): + self.client = Client() + + # Populate a CustomField to activate CustomFieldSerializer + content_type = ContentType.objects.get_for_model(Site) + self.cf_text = CustomField(type=CustomFieldTypeChoices.TYPE_TEXT, name='test') + self.cf_text.save() + self.cf_text.content_types.set([content_type]) + self.cf_text.save() + + def test_api_docs(self): + + url = reverse('api_docs') + response = self.client.get(url) + self.assertEqual(response.status_code, 200) + + url = reverse('schema') + response = self.client.get(url) + self.assertEqual(response.status_code, 200)