10711 add api test

This commit is contained in:
Arthur Hanson 2024-11-05 10:19:37 -08:00
parent cac5f03939
commit 530c4f3ed1

View File

@ -1,7 +1,7 @@
from django.urls import reverse from django.urls import reverse
from dcim.choices import InterfaceTypeChoices from dcim.choices import InterfaceTypeChoices
from dcim.models import Interface from dcim.models import Interface, Site
from tenancy.models import Tenant from tenancy.models import Tenant
from utilities.testing import APITestCase, APIViewTestCases, create_test_device from utilities.testing import APITestCase, APIViewTestCases, create_test_device
from wireless.choices import * from wireless.choices import *
@ -53,6 +53,12 @@ class WirelessLANTest(APIViewTestCases.APIViewTestCase):
@classmethod @classmethod
def setUpTestData(cls): def setUpTestData(cls):
sites = (
Site(name='Site 1', slug='site-1'),
Site(name='Site 2', slug='site-2'),
)
Site.objects.bulk_create(sites)
tenants = ( tenants = (
Tenant(name='Tenant 1', slug='tenant-1'), Tenant(name='Tenant 1', slug='tenant-1'),
Tenant(name='Tenant 2', slug='tenant-2'), Tenant(name='Tenant 2', slug='tenant-2'),
@ -94,6 +100,8 @@ class WirelessLANTest(APIViewTestCases.APIViewTestCase):
'status': WirelessLANStatusChoices.STATUS_DISABLED, 'status': WirelessLANStatusChoices.STATUS_DISABLED,
'tenant': tenants[0].pk, 'tenant': tenants[0].pk,
'auth_type': WirelessAuthTypeChoices.TYPE_WPA_ENTERPRISE, 'auth_type': WirelessAuthTypeChoices.TYPE_WPA_ENTERPRISE,
'scope_type': 'dcim.site',
'scope_id': sites[1].pk,
}, },
] ]