Skip to content

Commit f3c4c06

Browse files
committed
Add form_data to enable edit/delete unit tests for COTs and COTFs
1 parent 91ebb76 commit f3c4c06

File tree

1 file changed

+15
-30
lines changed

1 file changed

+15
-30
lines changed

netbox_custom_objects/tests/test_views.py

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ def setUpTestData(cls):
3131
slug="test-objects-2",
3232
)
3333

34+
cls.form_data = {
35+
'name': 'custom_object_type_1',
36+
'slug': 'custom-object-type-1s',
37+
}
38+
3439
def setUp(self):
3540
"""Set up test data."""
3641
super().setUp()
@@ -63,12 +68,6 @@ def test_create_object_with_permission(self):
6368
def test_create_object_with_constrained_permission(self):
6469
...
6570

66-
def test_edit_object_with_permission(self):
67-
...
68-
69-
def test_edit_object_with_constrained_permission(self):
70-
...
71-
7271
def test_bulk_edit_objects_with_permission(self):
7372
...
7473

@@ -84,12 +83,6 @@ def test_bulk_import_objects_with_permission(self):
8483
def test_bulk_import_objects_with_constrained_permission(self):
8584
...
8685

87-
def test_delete_object_with_permission(self):
88-
...
89-
90-
def test_delete_object_with_constrained_permission(self):
91-
...
92-
9386
def test_bulk_delete_objects_with_permission(self):
9487
...
9588

@@ -131,6 +124,16 @@ def setUpTestData(cls):
131124
description="Second test field"
132125
)
133126

127+
cls.form_data = {
128+
"custom_object_type": cls.custom_object_type.id,
129+
"name": "field3",
130+
"type": "text",
131+
"filter_logic": "loose",
132+
"ui_visible": "always",
133+
"ui_editable": "yes",
134+
"weight": 100,
135+
}
136+
134137
def setUp(self):
135138
"""Set up test data."""
136139
super().setUp()
@@ -181,18 +184,6 @@ def test_get_object_changelog(self):
181184
def test_export_objects(self):
182185
...
183186

184-
def test_create_object_with_permission(self):
185-
...
186-
187-
def test_create_object_with_constrained_permission(self):
188-
...
189-
190-
def test_edit_object_with_permission(self):
191-
...
192-
193-
def test_edit_object_with_constrained_permission(self):
194-
...
195-
196187
def test_bulk_edit_objects_with_permission(self):
197188
...
198189

@@ -214,15 +205,9 @@ def test_bulk_import_objects_without_permission(self):
214205
def test_bulk_import_objects_with_constrained_permission(self):
215206
...
216207

217-
def test_delete_object_with_permission(self):
218-
...
219-
220208
def test_bulk_delete_objects_without_permission(self):
221209
...
222210

223-
def test_delete_object_with_constrained_permission(self):
224-
...
225-
226211
def test_bulk_delete_objects_with_permission(self):
227212
...
228213

0 commit comments

Comments
 (0)