def test__get_joinedload_object_for_include__wrong_field_name( self, permission_user): qs = QueryStringManager({}, ModelWithMeta) with pytest.raises(InvalidInclude): PermissionPlugin._get_joinedload_object_for_include( 'wrong_field', qs, permission_user, ModelWithMetaSchema(), ModelWithMeta)
def test__get_joinedload_object_for_include(self, mock_is_access_foreign_key, mock_property, permission_user): qs = QueryStringManager({}, ModelWithMeta) result = PermissionPlugin._get_joinedload_object_for_include( 'related_model_id', qs, permission_user, ModelWithMetaSchema(), ModelWithMeta) assert result.path[0] == ModelWithMeta.related_model_id