mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 10:58:37 -06:00
Adds tests for L2VPNFilterSet.status
This commit is contained in:
parent
6aad45511f
commit
6229dab3f9
@ -326,7 +326,7 @@ class L2VPNFilterSet(NetBoxModelFilterSet, TenancyFilterSet):
|
||||
|
||||
class Meta:
|
||||
model = L2VPN
|
||||
fields = ('id', 'identifier', 'name', 'slug', 'type', 'description')
|
||||
fields = ('id', 'identifier', 'name', 'slug', 'status', 'type', 'description')
|
||||
|
||||
def search(self, queryset, name, value):
|
||||
if not value.strip():
|
||||
|
@ -769,6 +769,7 @@ class L2VPNTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
name='L2VPN 1',
|
||||
slug='l2vpn-1',
|
||||
type=L2VPNTypeChoices.TYPE_VXLAN,
|
||||
status=L2VPNStatusChoices.STATUS_ACTIVE,
|
||||
identifier=65001,
|
||||
description='foobar1'
|
||||
),
|
||||
@ -776,6 +777,7 @@ class L2VPNTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
name='L2VPN 2',
|
||||
slug='l2vpn-2',
|
||||
type=L2VPNTypeChoices.TYPE_VPWS,
|
||||
status=L2VPNStatusChoices.STATUS_PLANNED,
|
||||
identifier=65002,
|
||||
description='foobar2'
|
||||
),
|
||||
@ -783,6 +785,7 @@ class L2VPNTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
name='L2VPN 3',
|
||||
slug='l2vpn-3',
|
||||
type=L2VPNTypeChoices.TYPE_VPLS,
|
||||
status=L2VPNStatusChoices.STATUS_DECOMMISSIONING,
|
||||
description='foobar3'
|
||||
),
|
||||
)
|
||||
@ -814,6 +817,15 @@ class L2VPNTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
params = {'type': [L2VPNTypeChoices.TYPE_VXLAN, L2VPNTypeChoices.TYPE_VPWS]}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||
|
||||
def test_status(self):
|
||||
self.assertEqual(self.filterset({}, self.queryset).qs.count(), 3)
|
||||
|
||||
params = {'status': [L2VPNStatusChoices.STATUS_ACTIVE, L2VPNStatusChoices.STATUS_PLANNED]}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||
|
||||
params = {'status': [L2VPNStatusChoices.STATUS_DECOMMISSIONING]}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
|
||||
|
||||
def test_description(self):
|
||||
params = {'description': ['foobar1', 'foobar2']}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||
|
Loading…
Reference in New Issue
Block a user