mirror of
https://github.com/netbox-community/netbox.git
synced 2025-09-06 14:23:36 -06:00
Add test for test_get_prefetchable_fields
This commit is contained in:
parent
871eae5c4a
commit
f844d820a1
17
netbox/utilities/tests/test_prefetch.py
Normal file
17
netbox/utilities/tests/test_prefetch.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
from circuits.models import Circuit, Provider
|
||||||
|
from utilities.prefetch import get_prefetchable_fields
|
||||||
|
from utilities.testing.base import TestCase
|
||||||
|
|
||||||
|
|
||||||
|
class GetPrefetchableFieldsTest(TestCase):
|
||||||
|
"""
|
||||||
|
Verify the operation of get_prefetchable_fields()
|
||||||
|
"""
|
||||||
|
def test_get_prefetchable_fields(self):
|
||||||
|
field_names = get_prefetchable_fields(Provider)
|
||||||
|
self.assertIn('asns', field_names) # ManyToManyField
|
||||||
|
self.assertIn('circuits', field_names) # Reverse relation
|
||||||
|
self.assertIn('tags', field_names) # Tags
|
||||||
|
|
||||||
|
field_names = get_prefetchable_fields(Circuit)
|
||||||
|
self.assertIn('group_assignments', field_names) # Generic relation
|
Loading…
Reference in New Issue
Block a user