mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
more working
This commit is contained in:
@@ -7,8 +7,8 @@ import re
|
||||
from argenta.app import App
|
||||
from argenta.command import Command
|
||||
from argenta.router import Router
|
||||
from argenta.command.flag.models import Flags
|
||||
from argenta.command.flag.defaults import DefaultFlags
|
||||
from argenta.command.flag.models import Flags, InputFlags
|
||||
from argenta.command.flag.defaults import PredeterminedFlags
|
||||
|
||||
|
||||
|
||||
@@ -89,11 +89,11 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
||||
@patch("sys.stdout", new_callable=io.StringIO)
|
||||
def test_input_correct_command_with_one_correct_flag_an_one_incorrect_flag(self, mock_stdout: _io.StringIO, magick_mock: MagicMock):
|
||||
router = Router()
|
||||
flags = Flags(DefaultFlags.HOST)
|
||||
flags = Flags(PredeterminedFlags.HOST)
|
||||
|
||||
@router.command(Command('test', flags=flags))
|
||||
def test(args: dict):
|
||||
print(f'connecting to host {args["host"]["value"]}')
|
||||
def test(args: InputFlags):
|
||||
print(f'connecting to host {args.get_flag('host').get_value()}')
|
||||
|
||||
app = App()
|
||||
app.include_router(router)
|
||||
@@ -185,8 +185,8 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
||||
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))
|
||||
def test(args):
|
||||
@router.command(Command('test', flags=PredeterminedFlags.PORT))
|
||||
def test(args: InputFlags):
|
||||
print('test command')
|
||||
|
||||
app = App()
|
||||
|
||||
@@ -8,7 +8,7 @@ from argenta.app import App
|
||||
from argenta.command.models import Command
|
||||
from argenta.router import Router
|
||||
from argenta.command.flag.models import Flag, Flags, InputFlags
|
||||
from argenta.command.flag.defaults import DefaultFlags
|
||||
from argenta.command.flag.defaults import PredeterminedFlags
|
||||
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
||||
@patch("sys.stdout", new_callable=io.StringIO)
|
||||
def test_input_correct_command_with_default_flag(self, mock_stdout: _io.StringIO, magick_mock: MagicMock):
|
||||
router = Router()
|
||||
flag = DefaultFlags.SHORT_HELP
|
||||
flag = PredeterminedFlags.SHORT_HELP
|
||||
|
||||
@router.command(Command('test', flags=flag))
|
||||
def test(args: dict):
|
||||
@@ -109,7 +109,7 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
||||
@patch("sys.stdout", new_callable=io.StringIO)
|
||||
def test_input_correct_command_with_default_flag2(self, mock_stdout: _io.StringIO, magick_mock: MagicMock):
|
||||
router = Router()
|
||||
flag = DefaultFlags.INFO
|
||||
flag = PredeterminedFlags.INFO
|
||||
|
||||
@router.command(Command('test', flags=flag))
|
||||
def test(args: InputFlags):
|
||||
@@ -129,7 +129,7 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
||||
@patch("sys.stdout", new_callable=io.StringIO)
|
||||
def test_input_correct_command_with_default_flag3(self, mock_stdout: _io.StringIO, magick_mock: MagicMock):
|
||||
router = Router()
|
||||
flag = DefaultFlags.HOST
|
||||
flag = PredeterminedFlags.HOST
|
||||
|
||||
@router.command(Command('test', flags=flag))
|
||||
def test(args: InputFlags):
|
||||
@@ -148,7 +148,7 @@ class TestSystemHandlerNormalWork(unittest.TestCase):
|
||||
@patch("sys.stdout", new_callable=io.StringIO)
|
||||
def test_input_correct_command_with_two_flags(self, mock_stdout: _io.StringIO, magick_mock: MagicMock):
|
||||
router = Router()
|
||||
flags = Flags(DefaultFlags.HOST, DefaultFlags.PORT)
|
||||
flags = Flags(PredeterminedFlags.HOST, PredeterminedFlags.PORT)
|
||||
|
||||
@router.command(Command('test', flags=flags))
|
||||
def test(args: InputFlags):
|
||||
|
||||
Reference in New Issue
Block a user