Beispiel #1
0
    def test_global_shortcuts(self):
        request = BoltRequest(
            body=f"payload={quote(json.dumps(shortcut_payload))}")

        m = shortcut("test-shortcut")
        assert m.matches(request, None)
        m = shortcut({"callback_id": "test-shortcut", "type": "shortcut"})
        assert m.matches(request, None)

        m = shortcut("test-shortcut!!!")
        assert not m.matches(request, None)
        m = shortcut({
            "callback_id": "test-shortcut",
            "type": "message_action"
        })
        assert not m.matches(request, None)
        m = shortcut({"callback_id": "test-shortcut!!!", "type": "shortcut"})
        assert not m.matches(request, None)
Beispiel #2
0
 def __call__(*args, **kwargs):
     functions = self._to_listener_functions(
         kwargs) if kwargs else list(args)
     primary_matcher = builtin_matchers.shortcut(constraints, True)
     return self._register_listener(list(functions), primary_matcher,
                                    matchers, middleware)
Beispiel #3
0
 def __call__(func):
     primary_matcher = builtin_matchers.shortcut(constraints, True)
     return self._register_listener(func, primary_matcher, matchers,
                                    middleware)