Skip to content

Commit

Permalink
Adds test for additional attributes on relations
Browse files Browse the repository at this point in the history
  • Loading branch information
jfinkels committed Apr 2, 2016
1 parent a649b7a commit 9d317e5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_fetching.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,26 @@ def test_additional_attributes(self):
person = document['data']
assert person['attributes']['foo'] == 'bar'

def test_additional_attributes_not_related(self):
"""Tests that we do not try to include additional attributes when
requesting a related resource.
For more information, see pull request #257.
"""
self.Article.foo = 'bar'
person = self.Person(id=1)
article = self.Article(id=1)
article.author = person
self.session.add_all([person, article])
self.session.commit()
self.manager.create_api(self.Article, additional_attributes=['foo'])
self.manager.create_api(self.Person)
response = self.app.get('/api/article/1/author')
document = loads(response.data)
person = document['data']
assert 'foo' not in person['attributes']

def test_additional_attributes_callable(self):
"""Tests that callable attributes can be included using the
``additional_attributes`` keyword argument.
Expand Down

0 comments on commit 9d317e5

Please sign in to comment.