Skip to content
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

Wrap recorded calls on existing instance #3

Open
yalon opened this issue Aug 22, 2012 · 1 comment
Open

Wrap recorded calls on existing instance #3

yalon opened this issue Aug 22, 2012 · 1 comment

Comments

@yalon
Copy link
Contributor

yalon commented Aug 22, 2012

Instead of using the hybrid mock, allow the user to create his/her own instance so the constructor code will run, and then wrap the object with the recorded calls.

Something in the lines of:

mock_template = forge.create_mock_template(MyClass)
mock_template.foo().and_returns(42)

forge.replay()

my_obj = MyClass(my_var=1, another_var='foo')
mock_template.wrap(my_obj)

my_obj.foo() # return 42
my_obj.bar() # call the original function
@vmalloc
Copy link
Owner

vmalloc commented Dec 9, 2012

Isn't "MockWrapper" or "MockProxy" a better name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants