alchemy-mock icon indicating copy to clipboard operation
alchemy-mock copied to clipboard

Fail when call delete if the object doesn't exist.

Open kiliancm94 opened this issue 4 years ago • 2 comments

Hello,

First of all, a lot of thanks for sharing this library! It's very useful.

If I create a session, later I try to delete all the entries of a session mocked with some conditions not accomplished, it returns a UnifiedAlchemyMagicMock instead of returning None.

Do you know if I am doing something wrong or this function is not implemented?

Example:

session = UnifiedAlchemyMagicMock(data=[ ... ( ... [mock.call.query(Model), ... mock.call.filter(Model.name == 'bob', ... Model.age == 29)], ... [Model(name='bob, ... age=29)] ... ), ... ( ... [mock.call.query(Model), ... mock.call.filter(Model.name == 'alice', ... Model.age == 30)], ... [Model(name='alice', ... age=30)] ... ), ... ])

kiliancm94 avatar Feb 07 '20 14:02 kiliancm94

delete is currently not implemented. prs are welcome though! https://github.com/miki725/alchemy-mock/blob/master/alchemy_mock/mocking.py

miki725 avatar Feb 07 '20 14:02 miki725

Thanks!

kiliancm94 avatar Feb 07 '20 14:02 kiliancm94