def test_deserializing_relationship_errors(self): data = self.article data["data"]["relationships"]["author"]["data"] = {} data["data"]["relationships"]["comments"]["data"] = [{}] with pytest.raises(ValidationError) as excinfo: ArticleSchema().load(data) errors = excinfo.value.messages assert assert_relationship_error("author", errors["errors"]) assert assert_relationship_error("comments", errors["errors"])
def test_deserializing_relationship_errors(self): data = self.article data['data']['relationships']['author']['data'] = {} data['data']['relationships']['comments']['data'] = [{}] with pytest.raises(ValidationError) as excinfo: ArticleSchema().load(data) errors = excinfo.value.messages assert assert_relationship_error('author', errors['errors']) assert assert_relationship_error('comments', errors['errors'])
def test_deserializing_relationship_fields(self): data = unpack(ArticleSchema().load(self.article)) assert data["body"] == "Test" assert data["author"] == "1" assert data["comments"] == ["1"]
def test_deserializing_relationship_fields(self): data = unpack(ArticleSchema().load(self.article)) assert data['body'] == 'Test' assert data['author'] == '1' assert data['comments'] == ['1']