-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursive Mock #6
Comments
can you give an example of the model which allows |
@miki725 |
interesting. didnt know that. thanks @shosca not sure how that can be handled since |
I would like to understand how these objects could be extended to allow recursive operations. Let me explain a little of what this might look like. For example, it is often the case where
def setUp():
session = UnifiedAlchemyMagicMock( ...)
def my_test(self):
first_item = session.query(Blah).filter(Blah.foo == 'bar').first()
all_items = first_item.my_relationship.filter(Foo.bar == 'blah blah').all()
I can successfully replicate using examples the first item; however I would like all objects that are subsequently passed back from the UnifiedAlchemyMagicMock() class instance to have have embedded the same mixin as the session that I originally setup. This would allow "first_item.my_relationship.filter(" type calls on those objects via the same single setup.
My ultimate goal is also to boostrap the UnifiedAlchemyMagicMock.data from a json file; that I have first streamed out of a real set of SQLAlchemy objects. This
SQL DB ---> json file --> UnifiedAlchemyMagicMock.data --> tests
This way I can decouple the SQL DB but re-use a complex objects graph that spans my data base directly in mocked tests. The code in this repo is very close to allowing the first step; but the subsequent calls to alternative relationships and association_proxy, hybrid_properties and methods needs to be ideally supported.
The text was updated successfully, but these errors were encountered: