mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
v0.4.0
This commit is contained in:
@@ -4,7 +4,7 @@ from rich.console import Console
|
||||
|
||||
from argenta.command import Command
|
||||
from argenta.command.flag import Flag, FlagsGroup
|
||||
from argenta.command.flag.defaults import host_flag, port_flag
|
||||
from argenta.command.flag.defaults import DefaultFlags
|
||||
from argenta.router import Router
|
||||
from .handlers_implementation.help_command import help_command
|
||||
|
||||
@@ -23,7 +23,7 @@ def command_help():
|
||||
help_command()
|
||||
|
||||
|
||||
@work_router.command(Command(trigger='P', description='Start Solving', flags=FlagsGroup(host_flag, port_flag)))
|
||||
@work_router.command(Command(trigger='P', description='Start Solving', flags=FlagsGroup(DefaultFlags.host_flag, DefaultFlags.port_flag)))
|
||||
def command_start_solving(args: dict):
|
||||
print('Solving...')
|
||||
pprint(args)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "argenta"
|
||||
version = "0.3.9"
|
||||
version = "0.4.0"
|
||||
description = "python library for creating custom shells"
|
||||
authors = [
|
||||
{name = "kolo", email = "kolo.is.main@gmail.com"}
|
||||
|
||||
@@ -159,4 +159,40 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
||||
|
||||
output = mock_stdout.getvalue()
|
||||
|
||||
self.assertIn("Incorrect flag syntax: \"test 535 --port\"", output)
|
||||
self.assertIn("\nIncorrect flag syntax: \"test 535 --port\"\n", output)
|
||||
|
||||
|
||||
@patch("builtins.input", side_effect=["", "q"])
|
||||
@patch("sys.stdout", new_callable=io.StringIO)
|
||||
def test_input_empty_command(self, mock_stdout: _io.StringIO, magick_mock: MagicMock):
|
||||
router = Router()
|
||||
|
||||
@router.command(Command('test'))
|
||||
def test():
|
||||
print(f'test command')
|
||||
|
||||
app = App()
|
||||
app.include_router(router)
|
||||
app.start_polling()
|
||||
|
||||
output = mock_stdout.getvalue()
|
||||
|
||||
self.assertIn("\nEmpty input command\n", output)
|
||||
|
||||
|
||||
@patch("builtins.input", side_effect=["test --port 22 --port 33", "q"])
|
||||
@patch("sys.stdout", new_callable=io.StringIO)
|
||||
def test_input_correct_command_with_repeated_flags(self, mock_stdout: _io.StringIO, magick_mock: MagicMock):
|
||||
router = Router()
|
||||
|
||||
@router.command(Command('test', flags=DefaultFlags.port_flag))
|
||||
def test(args):
|
||||
print('test command')
|
||||
|
||||
app = App()
|
||||
app.include_router(router)
|
||||
app.start_polling()
|
||||
|
||||
output = mock_stdout.getvalue()
|
||||
|
||||
self.assertIn("\nRepeated input flags: \"test --port 22 --port 33\"", output)
|
||||
|
||||
Reference in New Issue
Block a user