File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class SiteSerializer(NetBoxModelSerializer):
5151 status = ChoiceField (choices = SiteStatusChoices , required = False )
5252 region = RegionSerializer (nested = True , required = False , allow_null = True )
5353 group = SiteGroupSerializer (nested = True , required = False , allow_null = True )
54- tenant = TenantSerializer (required = False , allow_null = True )
54+ tenant = TenantSerializer (nested = True , required = False , allow_null = True )
5555 time_zone = TimeZoneSerializerField (required = False , allow_null = True )
5656 asns = SerializedPKRelatedField (
5757 queryset = ASN .objects .all (),
Original file line number Diff line number Diff line change 1010from extras .models import ConfigTemplate
1111from ipam .models import ASN , RIR , VLAN , VRF
1212from netbox .api .serializers import GenericObjectSerializer
13+ from tenancy .models import Tenant
1314from utilities .testing import APITestCase , APIViewTestCases , create_test_device
1415from virtualization .models import Cluster , ClusterType
1516from wireless .choices import WirelessChannelChoices
@@ -152,6 +153,7 @@ def setUpTestData(cls):
152153 Site .objects .bulk_create (sites )
153154
154155 rir = RIR .objects .create (name = 'RFC 6996' , is_private = True )
156+ tenant = Tenant .objects .create (name = 'Tenant 1' , slug = 'tenant-1' )
155157
156158 asns = [
157159 ASN (asn = 65000 + i , rir = rir ) for i in range (8 )
@@ -166,6 +168,7 @@ def setUpTestData(cls):
166168 'group' : groups [1 ].pk ,
167169 'status' : SiteStatusChoices .STATUS_ACTIVE ,
168170 'asns' : [asns [0 ].pk , asns [1 ].pk ],
171+ 'tenant' : tenant .pk ,
169172 },
170173 {
171174 'name' : 'Site 5' ,
You can’t perform that action at this time.
0 commit comments