mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #3780: Fix AttributeError exception in API docs
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
# v2.6.10 (FUTURE)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
* [#3780](https://github.com/netbox-community/netbox/issues/3780) - Fix AttributeError exception in API docs
|
||||
|
||||
---
|
||||
|
||||
# v2.6.9 (2019-12-16)
|
||||
|
||||
## Enhancements
|
||||
@@ -13,6 +21,8 @@
|
||||
* [#3749](https://github.com/netbox-community/netbox/issues/3749) - Fix exception on password change page for local users
|
||||
* [#3757](https://github.com/netbox-community/netbox/issues/3757) - Fix unable to assign IP to interface
|
||||
|
||||
---
|
||||
|
||||
# v2.6.8 (2019-12-10)
|
||||
|
||||
## Enhancements
|
||||
@@ -35,6 +45,8 @@
|
||||
* [#3724](https://github.com/netbox-community/netbox/issues/3724) - Fix API filtering of interfaces by more than one device name
|
||||
* [#3725](https://github.com/netbox-community/netbox/issues/3725) - Enforce client validation for minimum service port number
|
||||
|
||||
---
|
||||
|
||||
# v2.6.7 (2019-11-01)
|
||||
|
||||
## Enhancements
|
||||
|
@@ -124,6 +124,9 @@ class CustomFieldModelSerializer(ValidatedModelSerializer):
|
||||
|
||||
else:
|
||||
|
||||
if not hasattr(self, 'initial_data'):
|
||||
self.initial_data = {}
|
||||
|
||||
# Populate default values
|
||||
if fields and 'custom_fields' not in self.initial_data:
|
||||
self.initial_data['custom_fields'] = {}
|
||||
|
@@ -1,7 +1,13 @@
|
||||
import urllib.parse
|
||||
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.test import Client, TestCase
|
||||
from django.urls import reverse
|
||||
from rest_framework import status
|
||||
|
||||
from dcim.models import Region, Site
|
||||
from extras.constants import CF_TYPE_TEXT
|
||||
from extras.models import CustomField
|
||||
from ipam.models import VLAN
|
||||
from utilities.testing import APITestCase
|
||||
|
||||
@@ -117,3 +123,26 @@ class WritableNestedSerializerTest(APITestCase):
|
||||
|
||||
self.assertHttpStatus(response, status.HTTP_400_BAD_REQUEST)
|
||||
self.assertEqual(VLAN.objects.count(), 0)
|
||||
|
||||
|
||||
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=CF_TYPE_TEXT, name='test')
|
||||
self.cf_text.save()
|
||||
self.cf_text.obj_type.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)
|
||||
|
Reference in New Issue
Block a user