File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,4 +127,6 @@ Contributors
127127
128128- Matthew Krueger (@mlkrueger1987)
129129
130- - Dejan Svetec (@dsvetec)
130+ - Dejan Svetec (@dsvetec)
131+
132+ - Billy Keyes (@bluekeyes)
Original file line number Diff line number Diff line change @@ -285,6 +285,7 @@ def refresh(self, conditional=False):
285285 headers = headers or None
286286 json = self ._json (self ._get (self ._api , headers = headers ), 200 )
287287 if json is not None :
288+ self ._json_data = json
288289 self ._update_attributes (json )
289290 return self
290291
Original file line number Diff line number Diff line change 11import io
2+ import json
23import pytest
34import requests
45
@@ -184,6 +185,21 @@ def test_refresh_etag(self):
184185 headers = expected_headers ,
185186 )
186187
188+ def test_refresh_json (self ):
189+ """Verify refreshing an object updates stored json data."""
190+ expected_data = {
191+ 'changed_files' : 4
192+ }
193+ response = requests .Response ()
194+ response .status_code = 200
195+ response .raw = io .BytesIO (json .dumps (expected_data ).encode ('utf8' ))
196+ self .session .get .return_value = response
197+
198+ self .instance .refresh ()
199+
200+ assert 'changed_files' in self .instance .as_dict ()
201+ assert self .instance .changed_files == 4
202+
187203 def test_strptime (self ):
188204 """Verify that method converts ISO 8601 formatted string."""
189205 dt = self .instance ._strptime ('2015-06-18T19:53:04Z' )
You can’t perform that action at this time.
0 commit comments