mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Disconnect search backend during test to avoid discrepancy with ContentTypes on transaction rollback
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
from django.db.models.signals import post_save
|
||||
from django.test import TransactionTestCase
|
||||
|
||||
from circuits.models import Provider, Circuit, CircuitType
|
||||
from extras.choices import ChangeActionChoices
|
||||
from extras.models import Branch, StagedChange, Tag
|
||||
from ipam.models import ASN, RIR
|
||||
from netbox.search.backends import search_backend
|
||||
from netbox.staging import checkout
|
||||
from utilities.testing import create_tags
|
||||
|
||||
@ -11,6 +13,10 @@ from utilities.testing import create_tags
|
||||
class StagingTestCase(TransactionTestCase):
|
||||
|
||||
def setUp(self):
|
||||
# Disconnect search backend to avoid issues with cached ObjectTypes being deleted
|
||||
# from the database upon transaction rollback
|
||||
post_save.disconnect(search_backend.caching_handler)
|
||||
|
||||
create_tags('Alpha', 'Bravo', 'Charlie')
|
||||
|
||||
rir = RIR.objects.create(name='RIR 1', slug='rir-1')
|
||||
|
Reference in New Issue
Block a user