Set __wrapped__ on MockAWS decorator to be the test function. cc #41.

This commit is contained in:
Steve Pulec 2013-09-10 08:27:28 -04:00
parent a0e2cb3d98
commit dc2802a238
2 changed files with 9 additions and 0 deletions

View File

@ -47,6 +47,7 @@ class MockAWS(object):
result = func(*args, **kwargs)
return result
functools.update_wrapper(wrapper, func)
wrapper.__wrapped__ = func
return wrapper

View File

@ -42,3 +42,11 @@ def test_decorator_start_and_stop():
mock.stop()
conn.get_all_instances.when.called_with().should.throw(EC2ResponseError)
@mock_ec2
def test_decorater_wrapped_gets_set():
"""
Moto decorator's __wrapped__ should get set to the tests function
"""
test_decorater_wrapped_gets_set.__wrapped__.__name__.should.equal('test_decorater_wrapped_gets_set')