mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 18:15:28 +03:00
modified tests
This commit is contained in:
@@ -149,9 +149,9 @@ class App:
|
|||||||
self._unknown_command_handler = handler
|
self._unknown_command_handler = handler
|
||||||
|
|
||||||
|
|
||||||
def set_empty_command_handler(self, handler: Callable[[str], None]) -> None:
|
def set_empty_command_handler(self, handler: Callable[[], None]) -> None:
|
||||||
args = getfullargspec(handler).args
|
args = getfullargspec(handler).args
|
||||||
if len(args) != 1:
|
if len(args) != 0:
|
||||||
raise IncorrectNumberOfHandlerArgsException()
|
raise IncorrectNumberOfHandlerArgsException()
|
||||||
else:
|
else:
|
||||||
self._empty_input_command_handler = handler
|
self._empty_input_command_handler = handler
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
|||||||
|
|
||||||
app = App()
|
app = App()
|
||||||
app.include_router(router)
|
app.include_router(router)
|
||||||
|
app.set_unknown_command_handler(lambda command: print(f'Unknown command: {command.get_trigger()}'))
|
||||||
app.start_polling()
|
app.start_polling()
|
||||||
|
|
||||||
output = mock_stdout.getvalue()
|
output = mock_stdout.getvalue()
|
||||||
@@ -42,6 +43,7 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
|||||||
|
|
||||||
app = App(ignore_command_register=False)
|
app = App(ignore_command_register=False)
|
||||||
app.include_router(router)
|
app.include_router(router)
|
||||||
|
app.set_unknown_command_handler(lambda command: print(f'Unknown command: {command.get_trigger()}'))
|
||||||
app.start_polling()
|
app.start_polling()
|
||||||
|
|
||||||
output = mock_stdout.getvalue()
|
output = mock_stdout.getvalue()
|
||||||
@@ -115,6 +117,7 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
|||||||
|
|
||||||
app = App()
|
app = App()
|
||||||
app.include_router(router)
|
app.include_router(router)
|
||||||
|
app.set_unknown_command_handler(lambda command: print(f'Unknown command: {command.get_trigger()}'))
|
||||||
app.start_polling()
|
app.start_polling()
|
||||||
|
|
||||||
output = mock_stdout.getvalue()
|
output = mock_stdout.getvalue()
|
||||||
@@ -137,6 +140,7 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
|||||||
|
|
||||||
app = App()
|
app = App()
|
||||||
app.include_router(router)
|
app.include_router(router)
|
||||||
|
app.set_unknown_command_handler(lambda command: print(f'Unknown command: {command.get_trigger()}'))
|
||||||
app.start_polling()
|
app.start_polling()
|
||||||
|
|
||||||
output = mock_stdout.getvalue()
|
output = mock_stdout.getvalue()
|
||||||
@@ -155,6 +159,7 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
|||||||
|
|
||||||
app = App()
|
app = App()
|
||||||
app.include_router(router)
|
app.include_router(router)
|
||||||
|
app.set_invalid_input_flags_handler(lambda command: print(f'Incorrect flag syntax: "{command}"'))
|
||||||
app.start_polling()
|
app.start_polling()
|
||||||
|
|
||||||
output = mock_stdout.getvalue()
|
output = mock_stdout.getvalue()
|
||||||
@@ -173,6 +178,7 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
|||||||
|
|
||||||
app = App()
|
app = App()
|
||||||
app.include_router(router)
|
app.include_router(router)
|
||||||
|
app.set_empty_command_handler(lambda: print('Empty input command'))
|
||||||
app.start_polling()
|
app.start_polling()
|
||||||
|
|
||||||
output = mock_stdout.getvalue()
|
output = mock_stdout.getvalue()
|
||||||
@@ -191,6 +197,7 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
|||||||
|
|
||||||
app = App()
|
app = App()
|
||||||
app.include_router(router)
|
app.include_router(router)
|
||||||
|
app.set_repeated_input_flags_handler(lambda command: print(f'Repeated input flags: "{command}"'))
|
||||||
app.start_polling()
|
app.start_polling()
|
||||||
|
|
||||||
output = mock_stdout.getvalue()
|
output = mock_stdout.getvalue()
|
||||||
|
|||||||
Reference in New Issue
Block a user