From 1b60debba751336947065a5f7312016b5b0c94a3 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Fri, 7 Apr 2023 13:42:20 +0200 Subject: [PATCH] Fixed cli schematics & added tests --- .../.cpl/schematic_application_extension.py | 3 ++- .../.cpl/schematic_startup_extension.py | 3 ++- src/cpl_cli/.cpl/schematic_test_case.py | 3 ++- unittests/unittests_core/core_test_suite.py | 24 +++++++++++++++++++ .../unittests_core/test_startup_extension.py | 16 +++++++++++++ unittests/unittests_core/utils/__init__.py | 0 .../utils/credential_manager_test_case.py | 10 ++++++++ .../unittests_core/utils/string_test_case.py | 10 ++++++++ 8 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 unittests/unittests_core/core_test_suite.py create mode 100644 unittests/unittests_core/test_startup_extension.py create mode 100644 unittests/unittests_core/utils/__init__.py create mode 100644 unittests/unittests_core/utils/credential_manager_test_case.py create mode 100644 unittests/unittests_core/utils/string_test_case.py diff --git a/src/cpl_cli/.cpl/schematic_application_extension.py b/src/cpl_cli/.cpl/schematic_application_extension.py index 4cbdb453..bb0a58b7 100644 --- a/src/cpl_cli/.cpl/schematic_application_extension.py +++ b/src/cpl_cli/.cpl/schematic_application_extension.py @@ -1,6 +1,7 @@ import textwrap from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC +from cpl_core.utils import String class ApplicationExtension(GenerateSchematicABC): @@ -22,7 +23,7 @@ class ApplicationExtension(GenerateSchematicABC): def run(self, config: ConfigurationABC, services: ServiceProviderABC): pass """ - x = self.build_code_str(code, Name=self._class_name) + x = self.build_code_str(code, Name=String.convert_to_camel_case(self._class_name)) return x @classmethod diff --git a/src/cpl_cli/.cpl/schematic_startup_extension.py b/src/cpl_cli/.cpl/schematic_startup_extension.py index 3bb74468..09455e78 100644 --- a/src/cpl_cli/.cpl/schematic_startup_extension.py +++ b/src/cpl_cli/.cpl/schematic_startup_extension.py @@ -1,6 +1,7 @@ import textwrap from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC +from cpl_core.utils import String class StartupExtension(GenerateSchematicABC): @@ -26,7 +27,7 @@ class StartupExtension(GenerateSchematicABC): def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): pass """ - x = self.build_code_str(code, Name=self._class_name) + x = self.build_code_str(code, Name=String.convert_to_camel_case(self._class_name)) return x @classmethod diff --git a/src/cpl_cli/.cpl/schematic_test_case.py b/src/cpl_cli/.cpl/schematic_test_case.py index a29144d4..cc6395e6 100644 --- a/src/cpl_cli/.cpl/schematic_test_case.py +++ b/src/cpl_cli/.cpl/schematic_test_case.py @@ -1,6 +1,7 @@ import textwrap from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC +from cpl_core.utils import String class TestCase(GenerateSchematicABC): @@ -20,7 +21,7 @@ class TestCase(GenerateSchematicABC): def test_equal(self): pass """ - return self.build_code_str(code, Name=self._class_name) + return self.build_code_str(code, Name=String.convert_to_camel_case(self._class_name)) @classmethod def register(cls): diff --git a/unittests/unittests_core/core_test_suite.py b/unittests/unittests_core/core_test_suite.py new file mode 100644 index 00000000..1b837049 --- /dev/null +++ b/unittests/unittests_core/core_test_suite.py @@ -0,0 +1,24 @@ +import unittest + +from unittests_core.utils.string_test_case import StringTestCase +from unittests_query.enumerable_query_test_case import EnumerableQueryTestCase +from unittests_query.enumerable_test_case import EnumerableTestCase +from unittests_query.iterable_query_test_case import IterableQueryTestCase +from unittests_query.iterable_test_case import IterableTestCase +from unittests_query.sequence_test_case import SequenceTestCase + + +class QueryTestSuite(unittest.TestSuite): + def __init__(self): + unittest.TestSuite.__init__(self) + + loader = unittest.TestLoader() + self.addTests(loader.loadTestsFromTestCase(StringTestCase)) + + def run(self, *args): + super().run(*args) + + +if __name__ == "__main__": + runner = unittest.TextTestRunner() + runner.run(QueryTestSuite()) diff --git a/unittests/unittests_core/test_startup_extension.py b/unittests/unittests_core/test_startup_extension.py new file mode 100644 index 00000000..7c1939f3 --- /dev/null +++ b/unittests/unittests_core/test_startup_extension.py @@ -0,0 +1,16 @@ +from cpl_core.application.startup_extension_abc import StartupExtensionABC +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC + + +class TestStartup_extension(StartupExtensionABC): + + def __init__(self): + pass + + def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + pass + + def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + pass diff --git a/unittests/unittests_core/utils/__init__.py b/unittests/unittests_core/utils/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/unittests/unittests_core/utils/credential_manager_test_case.py b/unittests/unittests_core/utils/credential_manager_test_case.py new file mode 100644 index 00000000..f1991eb4 --- /dev/null +++ b/unittests/unittests_core/utils/credential_manager_test_case.py @@ -0,0 +1,10 @@ +import unittest + + +class CredentialManagerTestCase(unittest.TestCase): + + def setUp(self): + pass + + def test_equal(self): + pass diff --git a/unittests/unittests_core/utils/string_test_case.py b/unittests/unittests_core/utils/string_test_case.py new file mode 100644 index 00000000..1fd4eddb --- /dev/null +++ b/unittests/unittests_core/utils/string_test_case.py @@ -0,0 +1,10 @@ +import unittest + + +class StringTestCase(unittest.TestCase): + + def setUp(self): + pass + + def test_equal(self): + pass