Skip to content

Commit

Permalink
Make relationship_descriptor tested
Browse files Browse the repository at this point in the history
Adds a no-op relationship_descriptor to the test app to make sure it
gets test coverage.
  • Loading branch information
duk3luk3 committed Jan 8, 2018
1 parent f9328b7 commit e920f8d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sqlalchemy_jsonapi/tests/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from sqlalchemy.orm import backref, relationship, validates
from sqlalchemy_jsonapi import (
FlaskJSONAPI, Permissions, permission_test, Method, Endpoint,
relationship_descriptor, RelationshipActions,
INTERACTIVE_PERMISSIONS)
from sqlalchemy_utils import EmailType, PasswordType, Timestamp, UUIDType

Expand Down Expand Up @@ -140,6 +141,12 @@ class BlogComment(Timestamp, db.Model):
lazy='joined',
backref=backref('comments',
lazy='dynamic'))

@relationship_descriptor(RelationshipActions.GET, 'post')
def post_get(self):
"""No-OP Relationship descriptor to exercise relationship_descriptor"""
return self.post

author = relationship('User',
lazy='joined',
backref=backref('comments',
Expand Down

0 comments on commit e920f8d

Please sign in to comment.