new models, a model is passed to the command handler instead of a dictionary, removal of checks for intersection of processed triggers in handlers and much, much more

This commit is contained in:
2025-03-31 19:14:42 +03:00
parent 2918bc9f81
commit 5c6fa5151a
24 changed files with 283 additions and 279 deletions
+5 -28
View File
@@ -1,11 +1,11 @@
from argenta.command.flag.registered_flag import Flag, FlagsGroup
from argenta.command.flag.models import Flag, Flags
import unittest
class TestFlagsGroup(unittest.TestCase):
class TestFlags(unittest.TestCase):
def test_get_flags(self):
flags = FlagsGroup()
flags = Flags()
list_of_flags = [
Flag('test1'),
Flag('test2'),
@@ -16,34 +16,11 @@ class TestFlagsGroup(unittest.TestCase):
list_of_flags)
def test_add_flag(self):
flags = FlagsGroup()
flags = Flags()
flags.add_flag(Flag('test'))
self.assertEqual(len(flags.get_flags()), 1)
def test_add_flags(self):
flags = FlagsGroup()
flags = Flags()
flags.add_flags([Flag('test'), Flag('test2')])
self.assertEqual(len(flags.get_flags()), 2)
def test_unparse_flags_to_dict(self):
list_of_flags = [
Flag('test1'),
Flag('test2'),
Flag('test3'),
]
flags = FlagsGroup(*list_of_flags)
serialized_flags = flags.unparse_to_dict()
needed_result = {'test1': {'name': 'test1',
'prefix': '--',
'string_entity': '--test1',
'value': None},
'test2': {'name': 'test2',
'prefix': '--',
'string_entity': '--test2',
'value': None},
'test3': {'name': 'test3',
'prefix': '--',
'string_entity': '--test3',
'value': None}}
self.assertDictEqual(serialized_flags, needed_result)