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
def test_parse_main_response_body(self): obj = ResponseObject('{}') obj._parse_main_response_body('rating', Rating, self.response) assert type(obj.rating) is Rating
def test_response_obj_parse_one(self): obj = ResponseObject('{}') obj._parse('location', Location, self.response) assert type(obj.location) is Location
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
def test_parse_main_response_body(self): obj = ResponseObject('{}') obj._parse_main_response_body('business', Business, self.response) assert type(obj.business) is Business