summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndy Davidoff <andy+github@disruptek.com>2014-07-19 16:12:21 -0400
committerAndy Davidoff <andy+github@disruptek.com>2014-07-19 16:12:21 -0400
commitb3e4d0bac5a4079e5513396cc26a3cad50332dda (patch)
tree47786aa6c1494143b1ca8034fddd49374dd60069 /tests
parent12057c1bcf25809ae03818d912977e417551b8b8 (diff)
downloadboto-b3e4d0bac5a4079e5513396cc26a3cad50332dda.tar.gz
add an assertion of @requires decorators order
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/mws/test_connection.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/unit/mws/test_connection.py b/tests/unit/mws/test_connection.py
index abfd2588..2c2c6057 100644
--- a/tests/unit/mws/test_connection.py
+++ b/tests/unit/mws/test_connection.py
@@ -82,6 +82,21 @@ doc/2009-01-01/">
destructure_object(user, result, prefix='Prefix', members=members)
self.assertEqual(result, amazon)
+ def test_decorator_order(self):
+ for action, func in api_call_map.items():
+ func = getattr(self.service_connection, func)
+ decs = [func.__name__]
+ while func:
+ i = 0
+ while i < len(func.__closure__):
+ value = func.__closure__[i].cell_contents
+ if hasattr(value, '__call__'):
+ if 'requires' == value.__name__:
+ self.assertTrue(not decs or decs[-1] == 'requires')
+ decs.append(value.__name__)
+ i += 1
+ func = getattr(func, '__wrapped__', None)
+
def test_built_api_call_map(self):
# Ensure that the map is populated.
# It starts empty, but the decorators should add to it as they're