Example #1
0
 def test_response_obj_sets_correct_fields(self):
     with io.open(resource_filename('json/test_response.json')) as resp:
         response = json.load(resp)
     obj = ResponseObject('{}')
     obj._fields = ['id', 'name']
     obj.__init__(response)
     assert obj.id == response['id']
     assert obj.name == response['name']
     assert hasattr(obj, 'do_not_display') is False
Example #2
0
 def test_parse_main_response_body(self):
     obj = ResponseObject('{}')
     obj._parse_main_response_body('rating', Rating, self.response)
     assert type(obj.rating) is Rating
Example #3
0
 def test_response_obj_parse_one(self):
     obj = ResponseObject('{}')
     obj._parse('location', Location, self.response)
     assert type(obj.location) is Location
Example #4
0
 def test_response_obj_parse_list(self):
     obj = ResponseObject('{}')
     obj._parse('deals', Deal, self.response)
     assert len(obj.deals) == len(self.response['deals'])
     assert type(obj.deals[0]) is Deal
Example #5
0
 def test_parse_main_response_body(self):
     obj = ResponseObject('{}')
     obj._parse_main_response_body('business', Business, self.response)
     assert type(obj.business) is Business
 def test_parse_main_response_body(self):
     obj = ResponseObject('{}')
     obj._parse_main_response_body('business', Business, self.response)
     assert type(obj.business) is Business