Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some tests for core.response.flatten_custom #637

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading