mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-26 10:28:37 -06:00
Fix tests
This commit is contained in:
parent
155932ea8e
commit
30e2456199
@ -1275,9 +1275,9 @@ class TagTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
}
|
||||
|
||||
tags = (
|
||||
Tag(name='Tag 1', slug='tag-1', color='ff0000', description='foobar1'),
|
||||
Tag(name='Tag 2', slug='tag-2', color='00ff00', description='foobar2'),
|
||||
Tag(name='Tag 3', slug='tag-3', color='0000ff', weight=1000),
|
||||
Tag(name='Tag 1', slug='tag-1', color='ff0000', weight=1000, description='foobar1'),
|
||||
Tag(name='Tag 2', slug='tag-2', color='00ff00', weight=2000, description='foobar2'),
|
||||
Tag(name='Tag 3', slug='tag-3', color='0000ff', weight=3000),
|
||||
)
|
||||
Tag.objects.bulk_create(tags)
|
||||
tags[0].object_types.add(object_types['site'])
|
||||
@ -1331,11 +1331,8 @@ class TagTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
)
|
||||
|
||||
def test_weight(self):
|
||||
params = {'weight': [1000]}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
|
||||
|
||||
params = {'weight': [0]}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 3)
|
||||
params = {'weight': [1000, 2000]}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||
|
||||
|
||||
class TaggedItemFilterSetTestCase(TestCase):
|
||||
|
@ -12,10 +12,10 @@ from virtualization.models import Cluster, ClusterGroup, ClusterType, VirtualMac
|
||||
class TagTest(TestCase):
|
||||
|
||||
def test_default_ordering_weight_then_name_is_set(self):
|
||||
Tag.objects.create(name='Tag 1', slug='tag-1', weight=100)
|
||||
Tag.objects.create(name='Tag 2', slug='tag-2')
|
||||
Tag.objects.create(name='Tag 3', slug='tag-3', weight=10)
|
||||
Tag.objects.create(name='Tag 4', slug='tag-4', weight=10)
|
||||
Tag.objects.create(name='Tag 1', slug='tag-1', weight=3000)
|
||||
Tag.objects.create(name='Tag 2', slug='tag-2') # Default: 1000
|
||||
Tag.objects.create(name='Tag 3', slug='tag-3', weight=2000)
|
||||
Tag.objects.create(name='Tag 4', slug='tag-4', weight=2000)
|
||||
|
||||
tags = Tag.objects.all()
|
||||
|
||||
@ -26,10 +26,10 @@ class TagTest(TestCase):
|
||||
|
||||
def test_tag_related_manager_ordering_weight_then_name(self):
|
||||
tags = [
|
||||
Tag.objects.create(name='Tag 1', slug='tag-1', weight=100),
|
||||
Tag.objects.create(name='Tag 2', slug='tag-2'),
|
||||
Tag.objects.create(name='Tag 3', slug='tag-3', weight=10),
|
||||
Tag.objects.create(name='Tag 4', slug='tag-4', weight=10),
|
||||
Tag.objects.create(name='Tag 1', slug='tag-1', weight=3000),
|
||||
Tag.objects.create(name='Tag 2', slug='tag-2'), # Default: 1000
|
||||
Tag.objects.create(name='Tag 3', slug='tag-3', weight=2000),
|
||||
Tag.objects.create(name='Tag 4', slug='tag-4', weight=2000),
|
||||
]
|
||||
|
||||
site = Site.objects.create(name='Site 1')
|
||||
|
Loading…
Reference in New Issue
Block a user