Browse Source

Add a test on hooks priority

Yann Weber 8 years ago
parent
commit
9cf1cc6884
1 changed files with 20 additions and 0 deletions
  1. 20
    0
      tests/plugin/tests_hooks.py

+ 20
- 0
tests/plugin/tests_hooks.py View File

@@ -40,4 +40,24 @@ class HookTestCase(unittest.TestCase):
40 40
         #Checks call
41 41
         mmock.assert_called_once_with(testhook, 'Caller', 'payload')
42 42
 
43
+    def test_priority_call(self):
44
+        """ Testing priority to ensure a call order """
45
+        @LodelHook(testhook, 1)
46
+        def stage_1_hook(name, caller, payload):
47
+            return '4'+payload
48
+
49
+        @LodelHook(testhook, 10)
50
+        def stage_1_hook(name, caller, payload):
51
+            return '3'+payload
52
+
53
+        @LodelHook(testhook, 20)
54
+        def stage_1_hook(name, caller, payload):
55
+            return '1'+payload
56
+
57
+        @LodelHook(testhook, 15)
58
+        def stage_1_hook(name, caller, payload):
59
+            return '2'+payload
60
+
61
+        result = LodelHook.call_hook(testhook, 'me', 'WootWoot')
62
+        self.assertEqual(result, '1234WootWoot')
43 63
 

Loading…
Cancel
Save