Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSheps committed Aug 30, 2024
1 parent 510da04 commit 4575af1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions netbox/circuits/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class CircuitTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'status': 'planned',
}
user_permissions = ('circuits.view_provider', 'circuits.view_circuittype')

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -150,6 +151,7 @@ def setUpTestData(cls):
class CircuitTerminationTest(APIViewTestCases.APIViewTestCase):
model = CircuitTermination
brief_fields = ['_occupied', 'cable', 'circuit', 'description', 'display', 'id', 'term_side', 'url']
user_permissions = ('circuits.view_circuit', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -241,6 +243,7 @@ def setUpTestData(cls):
class ProviderAccountTest(APIViewTestCases.APIViewTestCase):
model = ProviderAccount
brief_fields = ['account', 'description', 'display', 'id', 'name', 'url']
user_permissions = ('circuits.view_provider', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -287,6 +290,7 @@ class CircuitGroupAssignmentTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'priority': CircuitPriorityChoices.PRIORITY_INACTIVE,
}
user_permissions = ('circuits.view_circuitgroup', 'circuits.view_circuit')

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -355,6 +359,7 @@ def setUpTestData(cls):
class ProviderNetworkTest(APIViewTestCases.APIViewTestCase):
model = ProviderNetwork
brief_fields = ['description', 'display', 'id', 'name', 'url']
user_permissions = ('circuits.view_provider', )

@classmethod
def setUpTestData(cls):
Expand Down
1 change: 1 addition & 0 deletions netbox/core/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class DataFileTest(
):
model = DataFile
brief_fields = ['display', 'id', 'path', 'url']
user_permissions = ('core.view_datasource', )

@classmethod
def setUpTestData(cls):
Expand Down
27 changes: 27 additions & 0 deletions netbox/dcim/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ class LocationTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'description': 'New description',
}
user_permissions = ('dcim.view_site', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -277,6 +278,7 @@ class RackTypeTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'description': 'new description',
}
user_permissions = ('dcim.view_manufacturer', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -318,6 +320,7 @@ class RackTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'status': 'planned',
}
user_permissions = ('dcim.view_site', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -406,6 +409,7 @@ class RackReservationTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'description': 'New description',
}
user_permissions = ('dcim.view_rack', 'users.view_user')

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -485,6 +489,7 @@ class DeviceTypeTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'part_number': 'ABC123',
}
user_permissions = ('dcim.view_manufacturer', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -530,6 +535,7 @@ class ModuleTypeTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'part_number': 'ABC123',
}
user_permissions = ('dcim.view_manufacturer', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -701,6 +707,7 @@ class PowerOutletTemplateTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'description': 'New description',
}
user_permissions = ('dcim.view_devicetype', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -806,6 +813,7 @@ class FrontPortTemplateTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'description': 'New description',
}
user_permissions = ('dcim.view_rearporttemplate', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -983,6 +991,7 @@ class DeviceBayTemplateTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'description': 'New description',
}
user_permissions = ('dcim.view_device_type', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -1023,6 +1032,7 @@ class InventoryItemTemplateTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'description': 'New description',
}
user_permissions = ('dcim.view_device_type', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -1141,6 +1151,10 @@ class DeviceTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'status': 'failed',
}
user_permissions = (
'dcim.view_site', 'dcim.view_rack', 'dcim.view_location', 'dcim.view_devicerole', 'dcim.view_devicetype',
'extras.view_configtemplate',
)

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -1331,6 +1345,7 @@ class ModuleTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'serial': '1234ABCD',
}
user_permissions = ('dcim.view_modulebay', 'dcim.view_moduletype', 'dcim.view_device')

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -1397,6 +1412,7 @@ class ConsolePortTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCa
'description': 'New description',
}
peer_termination_type = ConsoleServerPort
user_permissions = ('dcim.view_device', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -1439,6 +1455,7 @@ class ConsoleServerPortTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIView
'description': 'New description',
}
peer_termination_type = ConsolePort
user_permissions = ('dcim.view_device', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -1481,6 +1498,7 @@ class PowerPortTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase
'description': 'New description',
}
peer_termination_type = PowerOutlet
user_permissions = ('dcim.view_device', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -1520,6 +1538,7 @@ class PowerOutletTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCa
'description': 'New description',
}
peer_termination_type = PowerPort
user_permissions = ('dcim.view_device', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -1568,6 +1587,7 @@ class InterfaceTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase
'description': 'New description',
}
peer_termination_type = Interface
user_permissions = ('dcim.view_device', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -1702,6 +1722,7 @@ class FrontPortTest(APIViewTestCases.APIViewTestCase):
'description': 'New description',
}
peer_termination_type = Interface
user_permissions = ('dcim.view_device', 'dcim.view_rearport')

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -1760,6 +1781,7 @@ class RearPortTest(APIViewTestCases.APIViewTestCase):
'description': 'New description',
}
peer_termination_type = Interface
user_permissions = ('dcim.view_device', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -1801,6 +1823,7 @@ class ModuleBayTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'description': 'New description',
}
user_permissions = ('dcim.view_device', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -1841,6 +1864,7 @@ class DeviceBayTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'description': 'New description',
}
user_permissions = ('dcim.view_device', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -1904,6 +1928,7 @@ class InventoryItemTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'description': 'New description',
}
user_permissions = ('dcim.view_device', 'dcim.view_manufacturer')

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -2200,6 +2225,7 @@ def setUpTestData(cls):
class PowerPanelTest(APIViewTestCases.APIViewTestCase):
model = PowerPanel
brief_fields = ['description', 'display', 'id', 'name', 'powerfeed_count', 'url']
user_permissions = ('dcim.view_site', )

@classmethod
def setUpTestData(cls):
Expand Down Expand Up @@ -2252,6 +2278,7 @@ class PowerFeedTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'status': 'planned',
}
user_permissions = ('dcim.power_panel', )

@classmethod
def setUpTestData(cls):
Expand Down
1 change: 1 addition & 0 deletions netbox/ipam/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ class FHRPGroupAssignmentTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'priority': 100,
}
user_permissions = ('ipam.view_fhrpgroup', )

@classmethod
def setUpTestData(cls):
Expand Down
1 change: 1 addition & 0 deletions netbox/tenancy/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ class ContactAssignmentTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'priority': ContactPriorityChoices.PRIORITY_INACTIVE,
}
user_permissions = ('tenancy.view_contact', )

@classmethod
def setUpTestData(cls):
Expand Down

0 comments on commit 4575af1

Please sign in to comment.