Skip to content

Commit ec907d5

Browse files
authored
Merge pull request #17 from ajbarry/fix-decorators
Fix _wrapped_func swallows return val
2 parents 250b854 + 85e8c83 commit ec907d5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/aws_secretsmanager_caching/decorators.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def _wrapped_func(*args, **kwargs):
4646
"""
4747
Internal function to execute wrapped function
4848
"""
49-
func(secret, *args, **kwargs)
49+
return func(secret, *args, **kwargs)
5050

5151
return _wrapped_func
5252

@@ -99,6 +99,6 @@ def _wrapped_func(*args, **kwargs):
9999
"""
100100
Internal function to execute wrapped function
101101
"""
102-
func(*args, **resolved_kwargs, **kwargs)
102+
return func(*args, **resolved_kwargs, **kwargs)
103103

104104
return _wrapped_func

test/unit/test_decorators.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ def function_to_be_decorated(func_username, func_password, keyworded_argument='f
5656
self.assertEqual(secret['username'], func_username)
5757
self.assertEqual(secret['password'], func_password)
5858
self.assertEqual(keyworded_argument, 'foo')
59+
return 'OK'
5960

60-
function_to_be_decorated()
61+
self.assertEqual(function_to_be_decorated(), 'OK')
6162

6263
def test_valid_json_with_mixed_args(self):
6364
secret = {
@@ -170,8 +171,9 @@ def function_to_be_decorated(arg1, arg2, arg3):
170171
self.assertEqual(arg1, secret)
171172
self.assertEqual(arg2, 'foo')
172173
self.assertEqual(arg3, 'bar')
174+
return 'OK'
173175

174-
function_to_be_decorated('foo', 'bar')
176+
self.assertEqual(function_to_be_decorated('foo', 'bar'), 'OK')
175177

176178
def test_string_with_additional_kwargs(self):
177179
secret = 'not json'

0 commit comments

Comments
 (0)