1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #4835: Support passing multiple initial values for multiple choice fields

This commit is contained in:
Jeremy Stretch
2020-07-08 12:50:12 -04:00
parent 20ee8ec107
commit fec3ee6f08
5 changed files with 54 additions and 21 deletions

View File

@ -1,15 +1,13 @@
from django.http import QueryDict
from django.test import TestCase
from utilities.utils import deepmerge, dict_to_filter_params
from utilities.utils import deepmerge, dict_to_filter_params, normalize_querydict
class DictToFilterParamsTest(TestCase):
"""
Validate the operation of dict_to_filter_params().
"""
def setUp(self):
return
def test_dict_to_filter_params(self):
input = {
@ -39,13 +37,21 @@ class DictToFilterParamsTest(TestCase):
self.assertNotEqual(dict_to_filter_params(input), output)
class NormalizeQueryDictTest(TestCase):
"""
Validate normalize_querydict() utility function.
"""
def test_normalize_querydict(self):
self.assertDictEqual(
normalize_querydict(QueryDict('foo=1&bar=2&bar=3&baz=')),
{'foo': '1', 'bar': ['2', '3'], 'baz': ''}
)
class DeepMergeTest(TestCase):
"""
Validate the behavior of the deepmerge() utility.
"""
def setUp(self):
return
def test_deepmerge(self):
dict1 = {