File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1818
1919from pynetbox .lib .query import Request
2020
21+ # List of fields that contain a dict but are not to be converted into
22+ # Record objects.
23+ JSON_FIELDS = ('custom_fields' , 'data' , 'config_context' )
24+
2125
2226def get_return (lookup , return_fields = None ):
2327 '''Returns simple representations for items passed to lookup.
@@ -147,7 +151,8 @@ def _parse_values(self, values):
147151 values within.
148152 """
149153 for k , v in values .items ():
150- if k != 'custom_fields' :
154+
155+ if k not in JSON_FIELDS :
151156 if isinstance (v , dict ):
152157 lookup = getattr (self .__class__ , k , None )
153158 if lookup :
Original file line number Diff line number Diff line change 6565 },
6666 "primary_ip6" : null ,
6767 "comments" : " " ,
68- "custom_fields" : {}
68+ "custom_fields" : {},
69+ "config_context" : {
70+ "test_key" : " test_val"
71+ }
6972}
Original file line number Diff line number Diff line change @@ -161,6 +161,8 @@ def test_get(self, mock):
161161 self .assertTrue (isinstance (ret , self .ret ))
162162 self .assertTrue (isinstance (ret .primary_ip , pynetbox .ipam .IpAddresses ))
163163 self .assertTrue (isinstance (ret .primary_ip4 , pynetbox .ipam .IpAddresses ))
164+ self .assertTrue (isinstance (ret .config_context , dict ))
165+ self .assertTrue (isinstance (ret .custom_fields , dict ))
164166 mock .assert_called_with (
165167 'http://localhost:8000/api/{}/{}/1/' .format (
166168 self .app ,
You can’t perform that action at this time.
0 commit comments