mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-18 13:38:16 -06:00
Clean up API tests
This commit is contained in:
parent
bce43eabc9
commit
2252c8ba01
@ -78,7 +78,7 @@ class EventRuleSerializer(NetBoxModelSerializer):
|
||||
fields = [
|
||||
'id', 'url', 'display', 'content_types', 'name', 'type_create', 'type_update', 'type_delete',
|
||||
'type_job_start', 'type_job_end', 'enabled', 'conditions', 'action_type', 'action_object_type',
|
||||
'action_object_id', 'action_object', 'custom_fields', 'tags', 'created', 'last_updated',
|
||||
'action_object_id', 'action_object', 'description', 'custom_fields', 'tags', 'created', 'last_updated',
|
||||
]
|
||||
|
||||
@extend_schema_field(OpenApiTypes.OBJECT)
|
||||
|
@ -72,6 +72,15 @@ class WebhookTest(APIViewTestCases.APIViewTestCase):
|
||||
class EventRuleTest(APIViewTestCases.APIViewTestCase):
|
||||
model = EventRule
|
||||
brief_fields = ['display', 'id', 'name',]
|
||||
bulk_update_data = {
|
||||
'enabled': False,
|
||||
'description': 'New description',
|
||||
}
|
||||
update_data = {
|
||||
'name': 'Event Rule X',
|
||||
'enabled': False,
|
||||
'description': 'New description',
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
@ -103,18 +112,14 @@ class EventRuleTest(APIViewTestCases.APIViewTestCase):
|
||||
)
|
||||
Webhook.objects.bulk_create(webhooks)
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
webhooks = Webhook.objects.all()
|
||||
event_rules = (
|
||||
EventRule(name='EventRule 1', action_object=webhooks[0]),
|
||||
EventRule(name='EventRule 2', action_object=webhooks[1]),
|
||||
EventRule(name='EventRule 3', action_object=webhooks[2]),
|
||||
EventRule(name='EventRule 1', type_create=True, action_object=webhooks[0]),
|
||||
EventRule(name='EventRule 2', type_create=True, action_object=webhooks[1]),
|
||||
EventRule(name='EventRule 3', type_create=True, action_object=webhooks[2]),
|
||||
)
|
||||
EventRule.objects.bulk_create(event_rules)
|
||||
|
||||
self.create_data = [
|
||||
cls.create_data = [
|
||||
{
|
||||
'name': 'EventRule 4',
|
||||
'content_types': ['dcim.device', 'dcim.devicetype'],
|
||||
|
Loading…
Reference in New Issue
Block a user