Rename EventRule.content_types to object_types & use ObjectType proxy

This commit is contained in:
Jeremy Stretch
2024-03-01 15:31:03 -05:00
parent ba514aceac
commit e51d71d7e6
15 changed files with 71 additions and 58 deletions

View File

@@ -397,7 +397,7 @@ class EventRulesTestCase(ViewTestCases.PrimaryObjectViewTestCase):
for webhook in webhooks:
webhook.save()
site_ct = ContentType.objects.get_for_model(Site)
site_type = ObjectType.objects.get_for_model(Site)
event_rules = (
EventRule(name='EventRule 1', type_create=True, action_object=webhooks[0]),
EventRule(name='EventRule 2', type_create=True, action_object=webhooks[1]),
@@ -405,12 +405,12 @@ class EventRulesTestCase(ViewTestCases.PrimaryObjectViewTestCase):
)
for event in event_rules:
event.save()
event.content_types.add(site_ct)
event.object_types.add(site_type)
webhook_ct = ContentType.objects.get_for_model(Webhook)
cls.form_data = {
'name': 'Event X',
'content_types': [site_ct.pk],
'object_types': [site_type.pk],
'type_create': False,
'type_update': True,
'type_delete': True,
@@ -423,7 +423,7 @@ class EventRulesTestCase(ViewTestCases.PrimaryObjectViewTestCase):
}
cls.csv_data = (
"name,content_types,type_create,action_type,action_object",
"name,object_types,type_create,action_type,action_object",
"Webhook 4,dcim.site,True,webhook,Webhook 1",
)