mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 12:12:53 -06:00
Add test to ensure no more broken sorting for CircuitTerminationTable
This commit is contained in:
parent
323173e0e2
commit
0c2ac033dd
23
netbox/circuits/tests/test_tables.py
Normal file
23
netbox/circuits/tests/test_tables.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
from django.test import RequestFactory, tag, TestCase
|
||||||
|
|
||||||
|
from circuits.models import CircuitTermination
|
||||||
|
from circuits.tables import CircuitTerminationTable
|
||||||
|
|
||||||
|
|
||||||
|
@tag('regression')
|
||||||
|
class CircuitTerminationTableTest(TestCase):
|
||||||
|
def test_every_orderable_field_does_not_throw_exception(self):
|
||||||
|
terminations = CircuitTermination.objects.all()
|
||||||
|
disallowed = {'actions', }
|
||||||
|
|
||||||
|
orderable_columns = [
|
||||||
|
column.name for column in CircuitTerminationTable(terminations).columns
|
||||||
|
if column.orderable and column.name not in disallowed
|
||||||
|
]
|
||||||
|
fake_request = RequestFactory().get("/")
|
||||||
|
|
||||||
|
for col in orderable_columns:
|
||||||
|
for dir in ('-', ''):
|
||||||
|
table = CircuitTerminationTable(terminations)
|
||||||
|
table.order_by = f'{dir}{col}'
|
||||||
|
table.as_html(fake_request)
|
Loading…
Reference in New Issue
Block a user