Skip to content

Commit

Permalink
Add some tests for core.response.flatten_custom (#637)
Browse files Browse the repository at this point in the history
Relates to #597
  • Loading branch information
costasd authored Aug 13, 2024
1 parent c84ca29 commit eebdb76
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/unit/test_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@
from unittest.mock import Mock, patch

from pynetbox.core.endpoint import Endpoint
from pynetbox.core.response import Record, RecordSet
from pynetbox.core.response import Record, RecordSet, flatten_custom


class FlattenCustomTest(unittest.TestCase):
def test_flatten_custom(self):
test_dicts = [
{"foo0": []},
{"foo1": [{"a": "b"}]},
{"foo2": [{"a": "b", "c": "d"}]},
{"foo3": 123},
{"foo4": "a"},
{"foo5": {"a": "b"}},
{"foo6": [{"a": "b", "c": "d"}]},
]
for test_dict in test_dicts:
ret = flatten_custom(test_dict)
assert ret == test_dict


class RecordTestCase(unittest.TestCase):
Expand Down

0 comments on commit eebdb76

Please sign in to comment.