Coverage for tests/command/builder/test_command_builder.py: 100%
23 statements
« prev ^ index » next coverage.py v7.1.0, created at 2023-01-30 18:57 -0500
« prev ^ index » next coverage.py v7.1.0, created at 2023-01-30 18:57 -0500
1"""Unit test file for command.builder.command_builder.py."""
2from src.probable_fiesta.command.builder import command_builder
3from src.probable_fiesta.logger.logging_config import set_logger
5from logging import DEBUG
6from unittest import TestCase
8# Create a logger
9LOG = set_logger("test_command_builder", DEBUG)
12class TestCommandBuilderCommandBuilder(TestCase):
14 def setUp(self):
15 self.command_builder = command_builder.CommandBuilder()
17 def test_init(self):
18 LOG.info("Test init")
19 cb = command_builder.CommandBuilder()
20 self.command_builder = cb
21 self.assertEqual(self.command_builder, cb)
23 def test_property_queue_add_new_command(self):
24 LOG.info("Test property queue add new command")
25 self.command_builder = command_builder.CommandBuilder()
26 self.command_builder.queue.add_new_command("test", lambda x: ("test"), "test").build()
27 # access inner command_queue
28 self.assertEqual(self.command_builder.queue.command_queue.length, 1)
30 def test_property_queue_add_new_command_chain(self):
31 LOG.info("Test property queue add new command chain")
32 self.command_builder = command_builder.CommandBuilder()
33 self.command_builder.queue\
34 .add_new_command("test1", lambda x: ("test"), "test")\
35 .add_new_command("test2", lambda x: ("test"), "test")\
36 .build()
37 # access inner command_queue
38 self.assertEqual(self.command_builder.queue.command_queue.length, 2)