Skip to content

Commit 986709d

Browse files
committed
Add regression test for #19610
1 parent aac106c commit 986709d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

netbox/vpn/tests/test_tables.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from django.test import RequestFactory, tag, TestCase
2+
3+
from vpn.models import TunnelTermination
4+
from vpn.tables import TunnelTerminationTable
5+
6+
7+
@tag('regression')
8+
class TunnelTerminationTableTest(TestCase):
9+
def test_every_orderable_field_does_not_throw_exception(self):
10+
terminations = TunnelTermination.objects.all()
11+
fake_request = RequestFactory().get("/")
12+
disallowed = {
13+
'actions',
14+
'termination', # TODO: remove this when #19600 is merged
15+
}
16+
17+
orderable_columns = [
18+
column.name for column in TunnelTerminationTable(terminations).columns
19+
if column.orderable and column.name not in disallowed
20+
]
21+
22+
for col in orderable_columns:
23+
for dir in ('-', ''):
24+
table = TunnelTerminationTable(terminations)
25+
table.order_by = f'{dir}{col}'
26+
table.as_html(fake_request)

0 commit comments

Comments
 (0)