mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 18:15:28 +03:00
fix: tests, imports
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
from argenta.app.models import App as App
|
__all__ = ["App", "Orchestrator", "Router"]
|
||||||
from argenta.orchestrator.entity import Orchestrator as Orchestrator
|
|
||||||
from argenta.router.entity import Router as Router
|
|
||||||
|
from argenta.orchestrator.entity import Orchestrator, App
|
||||||
|
from argenta.router.entity import Router
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
__all__ = [
|
__all__ = ["ArgParser", "Orchestrator"]
|
||||||
"ArgParser",
|
|
||||||
]
|
|
||||||
|
|
||||||
from argenta.orchestrator.argparser.entity import ArgParser
|
from argenta.orchestrator.argparser.entity import ArgParser
|
||||||
|
from argenta.orchestrator.entity import Orchestrator
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from argenta.app import App
|
from argenta.app.models import App
|
||||||
from argenta.orchestrator.argparser import ArgParser
|
from argenta.orchestrator.argparser import ArgParser
|
||||||
from argenta.orchestrator.argparser.entity import ArgSpace
|
from argenta.orchestrator.argparser.entity import ArgSpace
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from unittest.mock import patch, MagicMock
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
import io
|
import io
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
from argenta.command import Command, PredefinedFlags
|
from argenta.command import Command, PredefinedFlags
|
||||||
from argenta.command.flag.models import ValidationStatus
|
from argenta.command.flag.models import ValidationStatus
|
||||||
@@ -11,8 +12,15 @@ from argenta import Orchestrator, App, Router
|
|||||||
from argenta.response import Response
|
from argenta.response import Response
|
||||||
|
|
||||||
|
|
||||||
|
class PatchedArgvTestCase(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
super().setUp()
|
||||||
|
self.patcher = patch.object(sys, 'argv', ['program.py'])
|
||||||
|
self.mock_argv = self.patcher.start()
|
||||||
|
self.addCleanup(self.patcher.stop)
|
||||||
|
|
||||||
class TestSystemHandlerNormalWork(TestCase):
|
|
||||||
|
class TestSystemHandlerNormalWork(PatchedArgvTestCase):
|
||||||
@patch("builtins.input", side_effect=["help", "q"])
|
@patch("builtins.input", side_effect=["help", "q"])
|
||||||
@patch("sys.stdout", new_callable=io.StringIO)
|
@patch("sys.stdout", new_callable=io.StringIO)
|
||||||
def test_input_incorrect_command(self, mock_stdout: _io.StringIO, magick_mock: MagicMock):
|
def test_input_incorrect_command(self, mock_stdout: _io.StringIO, magick_mock: MagicMock):
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from unittest.mock import patch, MagicMock
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
import io
|
import io
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
from argenta.command import Command, PredefinedFlags
|
from argenta.command import Command, PredefinedFlags
|
||||||
from argenta.command.flag.models import PossibleValues, ValidationStatus
|
from argenta.command.flag.models import PossibleValues, ValidationStatus
|
||||||
@@ -12,8 +13,15 @@ from argenta.command.flag import Flag
|
|||||||
from argenta.command.flag.flags import Flags
|
from argenta.command.flag.flags import Flags
|
||||||
|
|
||||||
|
|
||||||
|
class PatchedArgvTestCase(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
super().setUp()
|
||||||
|
self.patcher = patch.object(sys, 'argv', ['program.py'])
|
||||||
|
self.mock_argv = self.patcher.start()
|
||||||
|
self.addCleanup(self.patcher.stop)
|
||||||
|
|
||||||
class TestSystemHandlerNormalWork(TestCase):
|
|
||||||
|
class TestSystemHandlerNormalWork(PatchedArgvTestCase):
|
||||||
@patch("builtins.input", side_effect=["test", "q"])
|
@patch("builtins.input", side_effect=["test", "q"])
|
||||||
@patch("sys.stdout", new_callable=io.StringIO)
|
@patch("sys.stdout", new_callable=io.StringIO)
|
||||||
def test_input_correct_command(self, mock_stdout: _io.StringIO, magick_mock: MagicMock):
|
def test_input_correct_command(self, mock_stdout: _io.StringIO, magick_mock: MagicMock):
|
||||||
|
|||||||
Reference in New Issue
Block a user