From e920f8d21b5230de10d32edada23102290e1a9b3 Mon Sep 17 00:00:00 2001 From: Lukas Erlacher Date: Mon, 8 Jan 2018 14:10:42 +1100 Subject: [PATCH] Make relationship_descriptor tested Adds a no-op relationship_descriptor to the test app to make sure it gets test coverage. --- sqlalchemy_jsonapi/tests/app.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sqlalchemy_jsonapi/tests/app.py b/sqlalchemy_jsonapi/tests/app.py index 8dd0c17..7624994 100644 --- a/sqlalchemy_jsonapi/tests/app.py +++ b/sqlalchemy_jsonapi/tests/app.py @@ -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 @@ -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',