Skip to content

Commit

Permalink
Fixes: #133 - Add tests for remaining config parameters (#180)
Browse files Browse the repository at this point in the history
* Add config tests

* Add newline
  • Loading branch information
bctiemann authored Dec 11, 2024
1 parent 01f044f commit f371851
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions netbox_branching/tests/test_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from django.test import TransactionTestCase, override_settings

from netbox.registry import registry
from netbox_branching.models import Branch
from netbox_branching.utilities import register_models


class ConfigTestCase(TransactionTestCase):
serialized_rollback = True

@override_settings(PLUGINS_CONFIG={
'netbox_branching': {
'exempt_models': ['ipam.prefix'],
}
})
def test_exempt_models(self):
register_models()
self.assertNotIn('prefix', registry['model_features']['branching']['ipam'])

@override_settings(PLUGINS_CONFIG={
'netbox_branching': {
'schema_prefix': 'dummy_',
}
})
def test_schema_prefix(self):
branch = Branch(name='Branch 5')
self.assertEqual(branch.schema_name, f'dummy_{branch.schema_id}')

0 comments on commit f371851

Please sign in to comment.