diff --git a/moto/core/models.py b/moto/core/models.py index c451fb11..f3e6ad70 100644 --- a/moto/core/models.py +++ b/moto/core/models.py @@ -47,6 +47,7 @@ class MockAWS(object): result = func(*args, **kwargs) return result functools.update_wrapper(wrapper, func) + wrapper.__wrapped__ = func return wrapper diff --git a/tests/test_core/test_decorator_calls.py b/tests/test_core/test_decorator_calls.py index f9bdbe1a..444bae89 100644 --- a/tests/test_core/test_decorator_calls.py +++ b/tests/test_core/test_decorator_calls.py @@ -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')