def test_address_json_include_user__success(self):
        data, errors = AddressSchema.jsonapi(self.addr, include_data=['user'])

        assert errors == {}
        assert type(data) is str

        expected_result = EXPECTED_ADDRESSES['get_address_json_include_user__success']
        assert_valid_response(data, expected_result)
    def test_get_addresses_list__success(self):
        add_address(
            self.user, id='4373d5d7-cae5-42bc-b218-d6fc6d18626f')

        addr_list = [a for a in Address.select()]
        data = AddressSchema.jsonapi_list(addr_list)

        expected_result = EXPECTED_ADDRESSES['get_addresses_list__success']
        assert_valid_response(data, expected_result)
    def test_address_validate_input__fail(self):
        data = copy.deepcopy(self.data)
        data['country'] = ''
        del data['relationships']['user']

        post_data = format_jsonapi_request('address', data)
        errors = AddressSchema.validate_input(post_data)

        expected_result = EXPECTED_ADDRESSES['address_validate_input__fail']
        assert_valid_response(errors, expected_result)
    def test_address_validate_input__success(self):
        post_data = format_jsonapi_request('address', self.data)
        errors = AddressSchema.validate_input(post_data)

        assert errors == {}
Beispiel #5
0
 def get_schema(cls):
     return AddressSchema()