Coverage for tests/app/builder/test_app_builder.py: 100%
17 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 app.builder.app_builder.py."""
2from src.probable_fiesta.app.builder import app_builder
3from src.probable_fiesta.app.builder import context
4from src.probable_fiesta.logger.logging_config import set_logger
5from src.probable_fiesta.command.builder.command_factory import CommandFactory
6from src.probable_fiesta.command.builder.command_queue import CommandQueue
8# Create a logger
9from logging import DEBUG
10from unittest import TestCase
11LOG = set_logger("test_app_builder", DEBUG)
14class TestAppBuilderMyAppBuilder(TestCase):
16 def setUp(self):
17 self.aB = app_builder.AppBuilder()
19 def test_init(self):
20 LOG.info("Test init")
22 self.aB = app_builder.AppBuilder()
23 app = self.aB\
24 .name\
25 .set_name("app_name")\
26 .arguments\
27 .set_arguments(["--test-app", "test_argument"])\
28 .args_parser\
29 .add_argument("--test-app", type=str, help="test app builder")\
30 .context\
31 .add_context(context.Context.Factory().new_context(
32 "test_app",
33 CommandQueue.new([
34 [CommandFactory.new_command("test_app_func", lambda x: x, "repeated")]
35 ])))\
36 .validate()\
37 .build()
38 print(app)
39 self.assertEqual(app.name, "app_name")