Fix test isolation in the shared test fixtures
Fixtures were created in setUpClass, so a test that changed the shared license instance affected later tests. Use setUpTestData, which rolls back after the class and gives each test its own copy. All 20 tests pass on NetBox 4.7.2. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
5eff411db9
commit
0826ea606b
2 files changed
+2
-25
No files matched your search
@@ -12,11 +12,6 @@ class FunctionalTestCase(SlmBaseTestCase):
|
||||
test_user, _ = get_user_model().objects.get_or_create(username="test", is_superuser=True)
|
||||
self.client.force_login(test_user)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
get_user_model().objects.all().delete()
|
||||
super().tearDownClass()
|
||||
|
||||
def test_template_content(self):
|
||||
cluster_response = self.client.get(f"/virtualization/clusters/{self.cluster.pk}/")
|
||||
self.assertContains(cluster_response, f'<a href="/plugins/slm/installations/add/?cluster={self.cluster.pk}"')
|
||||
|
||||
Reference in new issue
Block a user