mrevutskyi / flask-restless-ng

A Flask extension for creating simple ReSTful JSON APIs from SQLAlchemy models.
https://flask-restless-ng.readthedocs.io
Other
64 stars 11 forks source link

Relationships are not commited, but return no error #1

Closed pavlot closed 3 years ago

pavlot commented 4 years ago

This commented out code makes that relationships are not commited

https://github.com/mrevutskyi/flask-restless-ng/blob/3edf5de504dd0cb45fd049ee9e7430f9a84b8c77/flask_restless/views/relationships.py#L178

I suspect idea was done to allow postprocessors can rollback changes, but now it makes that relationship is not saved.

Also I think that tests should be improved to check not only return status, but try to reload relationship and check whether it exists. Now code return HTTP-204, but it do nothing

mrevutskyi commented 4 years ago

hi @pavlot, thank you for the report. Sorry, haven't noticed it earlier.

Do you have a scenario I can reproduce the issue? Or what specific test you are referring to? tests in test_updating_relationships.py do check db changes. E.g.

assert response.status_code == 204 articles = sorted(person.articles, key=attrgetter('id')) assert [article1, article2] == articles

mrevutskyi commented 3 years ago

Closing the issue as I'm not able to reproduce, please reopen if you are still facing it