summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
author苏向夜 <fu050409@163.com>2024-01-27 22:27:41 +0800
committer苏向夜 <fu050409@163.com>2024-01-27 22:27:41 +0800
commit1d9a500b727e8879cdaeb9c378ac717001c56ccc (patch)
tree58d3dd78970d2458372ac67353163f602c0cf017 /tests
parent69e46bfe4d5429f9c3eebb1747bd8e5290f7823b (diff)
downloadinfini-1d9a500b727e8879cdaeb9c378ac717001c56ccc.tar.gz
infini-1d9a500b727e8879cdaeb9c378ac717001c56ccc.zip
:sparkles: feat(router): supports alias router
Diffstat (limited to 'tests')
-rw-r--r--tests/test_core.py8
-rw-r--r--tests/test_handlers.py12
-rw-r--r--tests/test_interceptor.py4
3 files changed, 12 insertions, 12 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index 01d7ecb4..11a8c57d 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -4,7 +4,7 @@ from infini.handler import Handler
from infini.input import Input
from infini.interceptor import Interceptor
from infini.output import Output
-from infini.router import ContainsRouter, StartswithRouter
+from infini.router import Contains, Startswith
def test_core():
@@ -20,7 +20,7 @@ def test_core():
interceptor.interceptors = [
{
"priority": 1,
- "router": ContainsRouter("简律纯"),
+ "router": Contains("简律纯"),
"handler": intercept_jianlvchun,
}
]
@@ -38,12 +38,12 @@ def test_core():
handler.handlers = [
{
"priority": 2,
- "router": StartswithRouter(".add"),
+ "router": Startswith(".add"),
"handler": add,
},
{
"priority": 1,
- "router": StartswithRouter("."),
+ "router": Startswith("."),
"handler": cmd,
},
]
diff --git a/tests/test_handlers.py b/tests/test_handlers.py
index 00bb6f84..ee96cdab 100644
--- a/tests/test_handlers.py
+++ b/tests/test_handlers.py
@@ -1,7 +1,7 @@
from infini.handler import Handler
from infini.input import Input
from infini.output import Output
-from infini.router import StartswithRouter
+from infini.router import Startswith
def test_handler():
@@ -22,12 +22,12 @@ def test_handler():
handler.handlers = [
{
"priority": 2,
- "router": StartswithRouter(".add"),
+ "router": Startswith(".add"),
"handler": add,
},
{
"priority": 1,
- "router": StartswithRouter("."),
+ "router": Startswith("."),
"handler": cmd,
},
]
@@ -56,12 +56,12 @@ def test_handler_block():
handler.handlers = [
{
"priority": 2,
- "router": StartswithRouter(".add"),
+ "router": Startswith(".add"),
"handler": add,
},
{
"priority": 1,
- "router": StartswithRouter("."),
+ "router": Startswith("."),
"handler": cmd,
},
]
@@ -88,7 +88,7 @@ def test_handler_interator():
handler.handlers = [
{
"priority": 1,
- "router": StartswithRouter(".add"),
+ "router": Startswith(".add"),
"handler": add,
},
]
diff --git a/tests/test_interceptor.py b/tests/test_interceptor.py
index afb135e9..ffb03d56 100644
--- a/tests/test_interceptor.py
+++ b/tests/test_interceptor.py
@@ -1,7 +1,7 @@
from infini.input import Input
from infini.interceptor import Interceptor
from infini.output import Output
-from infini.router import ContainsRouter
+from infini.router import Contains
def test_interceptor():
@@ -15,7 +15,7 @@ def test_interceptor():
interceptor.interceptors = [
{
"priority": 1,
- "router": ContainsRouter("简律纯"),
+ "router": Contains("简律纯"),
"handler": intercept,
}
]