예제 #1
0
    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"])
예제 #2
0
    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'])
예제 #3
0
 def test_deserializing_relationship_fields(self):
     data = unpack(ArticleSchema().load(self.article))
     assert data["body"] == "Test"
     assert data["author"] == "1"
     assert data["comments"] == ["1"]
예제 #4
0
 def test_deserializing_relationship_fields(self):
     data = unpack(ArticleSchema().load(self.article))
     assert data['body'] == 'Test'
     assert data['author'] == '1'
     assert data['comments'] == ['1']