Merge pull request '2020.12.13' (#9) from 2020.12.13 into 2020.12

Reviewed-on: sh-edraft.de/sh_common_py_lib#9
This commit is contained in:
Sven Heidemann 2021-02-04 10:36:28 +01:00
commit 517c2c797c
52 changed files with 1362 additions and 885 deletions

4
.gitignore vendored
View File

@ -26,7 +26,6 @@ share/python-wheels/
.installed.cfg .installed.cfg
*.egg *.egg
MANIFEST MANIFEST
.idea/
# PyInstaller # PyInstaller
# Usually these files are written by a python script from a template # Usually these files are written by a python script from a template
@ -129,3 +128,6 @@ dmypy.json
# Pyre type checker # Pyre type checker
.pyre/ .pyre/
# IDE
.vscode/

View File

@ -0,0 +1,3 @@
<component name="ProjectDictionaryState">
<dictionary name="sven" />
</component>

View File

@ -0,0 +1,17 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="termcolor" />
<item index="1" class="java.lang.String" itemvalue="discord" />
<item index="2" class="java.lang.String" itemvalue="mysql-connector" />
<item index="3" class="java.lang.String" itemvalue="flask" />
</list>
</value>
</option>
</inspection_tool>
</profile>
</component>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectPlainTextFileTypeManager">
<file url="file://$PROJECT_DIR$/publish_templates/all_template.txt" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/sh_common_py_lib.iml" filepath="$PROJECT_DIR$/.idea/sh_common_py_lib.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/dist" />
<excludeFolder url="file://$MODULE_DIR$/src/tests/logs" />
<excludeFolder url="file://$MODULE_DIR$/src/tests_dev/logs" />
<excludeFolder url="file://$MODULE_DIR$/src/sh_edraft.egg-info" />
<excludeFolder url="file://$MODULE_DIR$/src/dist" />
<excludeFolder url="file://$MODULE_DIR$/src/build" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/src/tests/old" />
<excludeFolder url="file://$MODULE_DIR$/.vscode" />
<excludeFolder url="file://$MODULE_DIR$/build_test" />
</content>
<orderEntry type="jdk" jdkName="Python 3.9" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,4 @@
<changelist name="Uncommitted_changes_before_Update_at_26_11_2020_10_36_[Default_Changelist]" date="1606383362450" recycled="false" toDelete="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_26_11_2020_10_36_[Default_Changelist]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Update at 26.11.2020 10:36 [Default Changelist]" />
</changelist>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

868
.idea/workspace.xml Normal file
View File

@ -0,0 +1,868 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="BranchesTreeState">
<expand>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
</path>
</expand>
<select />
</component>
<component name="ChangeListManager">
<list default="true" id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="Removed unused packages">
<change afterPath="$PROJECT_DIR$/src/tests/publish_test/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/tests/publish_test/publisher_test.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/tests/setup.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/sh_common_py_lib.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/sh_common_py_lib.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/build/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/build/app.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/publish/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/publish/app.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/base/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/base/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/base/publisher_base.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/base/publisher_base.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/model/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/model/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/model/publish_settings_model.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/model/publish_settings_model.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/model/publish_settings_name.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/model/publish_settings_name.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/model/template.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/model/template.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/model/template_enum.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/model/template_enum.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/sh_edraft/publishing/publisher.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/sh_edraft/publish/publisher.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/appsettings.edrafts-lapi.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/appsettings.edrafts-lapi.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/appsettings.edrafts-pc.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/appsettings.edrafts-pc.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/build.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/build.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/service_test/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/service_test/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/time_test/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/time_test/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/utils_test/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/utils_test/__init__.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
<option value="Python Unit Test" />
</list>
</option>
</component>
<component name="Git.Pull.Settings">
<option name="BRANCH" value="2020.12.6" />
</component>
<component name="Git.Rebase.Settings">
<option name="NEW_BASE" value="2020.12" />
</component>
<component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="2020.12" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
<option name="RESET_MODE" value="HARD" />
<option name="UPDATE_TYPE" value="REBASE" />
</component>
<component name="ProjectId" id="1kYeNqJzjIXigSYYCzg4D16FL1E" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/tests" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/tests" />
<recent name="$PROJECT_DIR$/src/tests_dev" />
<recent name="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/database" />
<recent name="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/publish" />
<recent name="$PROJECT_DIR$/src" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/tests" />
<recent name="$PROJECT_DIR$/src/tests/publish_test" />
<recent name="$PROJECT_DIR$/src/tests/old" />
<recent name="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/commands/build" />
<recent name="$PROJECT_DIR$/src" />
</key>
</component>
<component name="RunManager" selected="Python tests.Unittests">
<configuration name="cli build" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="build test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli database migration" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/tests_dev" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="db mig add InitialMigration" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli database update" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/tests_dev" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="database update" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli help" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="help" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli new app" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="new app ./Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli new base" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="new app ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli new class" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="new class ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli new configmodel" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="new configmodel ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli new enum" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="new enum ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli new service" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="new service ./Test/Test" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli publish" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="publish" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli version" type="PythonConfigurationType" factoryName="Python">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="version" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="cli" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/sh_edraft/cli/cpl_cli/cli.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
<env name="CPL_NAME" value="CPL_Dev_Test" />
<env name="PYTHON_ENVIRONMENT" value="development" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/tests_dev" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/tests_dev/main.py" />
<option name="PARAMETERS" value="--customer=sh-edraft.de" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="Unittests" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="CPL_ENVIRONMENT" value="testing" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/tests" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="_new_pattern" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;discover -s $PROJECT_DIR$/src/tests -p \u0027*_test.py\u0027&quot;" />
<option name="_new_target" value="&quot;&quot;" />
<option name="_new_targetType" value="&quot;CUSTOM&quot;" />
<method v="2" />
</configuration>
<configuration name="Unittests" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
<module name="sh_common_py_lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="CPL_ENVIRONMENT" value="testing" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/tests" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="_new_pattern" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;discover -s $PROJECT_DIR$/src/tests -p \u0027*_test.py\u0027&quot;" />
<option name="_new_target" value="&quot;&quot;" />
<option name="_new_targetType" value="&quot;CUSTOM&quot;" />
<method v="2" />
</configuration>
<list>
<item itemvalue="Python.cli build" />
<item itemvalue="Python.cli database migration" />
<item itemvalue="Python.cli database update" />
<item itemvalue="Python.cli help" />
<item itemvalue="Python.cli new app" />
<item itemvalue="Python.cli new base" />
<item itemvalue="Python.cli new class" />
<item itemvalue="Python.cli new configmodel" />
<item itemvalue="Python.cli new enum" />
<item itemvalue="Python.cli new service" />
<item itemvalue="Python.cli publish" />
<item itemvalue="Python.cli version" />
<item itemvalue="Python.cli" />
<item itemvalue="Python.main" />
<item itemvalue="Python tests.Unittests" />
</list>
<recent_temporary>
<list>
<item itemvalue="Python tests.Unittests" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="" />
<created>1605881914521</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1605881914521</updated>
</task>
<task id="LOCAL-00031" summary="Improved database module structure">
<created>1607285697331</created>
<option name="number" value="00031" />
<option name="presentableId" value="LOCAL-00031" />
<option name="project" value="LOCAL" />
<updated>1607285697331</updated>
</task>
<task id="LOCAL-00032" summary="Improved database module structure">
<created>1607620265254</created>
<option name="number" value="00032" />
<option name="presentableId" value="LOCAL-00032" />
<option name="project" value="LOCAL" />
<updated>1607620265254</updated>
</task>
<task id="LOCAL-00033" summary="Changed DatabaseConnection">
<created>1607712129507</created>
<option name="number" value="00033" />
<option name="presentableId" value="LOCAL-00033" />
<option name="project" value="LOCAL" />
<updated>1607712129507</updated>
</task>
<task id="LOCAL-00034" summary="Improved session reference">
<created>1607971885250</created>
<option name="number" value="00034" />
<option name="presentableId" value="LOCAL-00034" />
<option name="project" value="LOCAL" />
<updated>1607971885250</updated>
</task>
<task id="LOCAL-00035" summary="Added console module">
<created>1607976456889</created>
<option name="number" value="00035" />
<option name="presentableId" value="LOCAL-00035" />
<option name="project" value="LOCAL" />
<updated>1607976456889</updated>
</task>
<task id="LOCAL-00036" summary="Added console module">
<created>1607976626173</created>
<option name="number" value="00036" />
<option name="presentableId" value="LOCAL-00036" />
<option name="project" value="LOCAL" />
<updated>1607976626173</updated>
</task>
<task id="LOCAL-00037" summary="Improved console">
<created>1608037411172</created>
<option name="number" value="00037" />
<option name="presentableId" value="LOCAL-00037" />
<option name="project" value="LOCAL" />
<updated>1608037411172</updated>
</task>
<task id="LOCAL-00038" summary="Improved console">
<created>1608047595029</created>
<option name="number" value="00038" />
<option name="presentableId" value="LOCAL-00038" />
<option name="project" value="LOCAL" />
<updated>1608047595029</updated>
</task>
<task id="LOCAL-00039" summary="Improved ApplicationHost">
<created>1608047655667</created>
<option name="number" value="00039" />
<option name="presentableId" value="LOCAL-00039" />
<option name="project" value="LOCAL" />
<updated>1608047655667</updated>
</task>
<task id="LOCAL-00040" summary="Improved publisher">
<created>1608048544558</created>
<option name="number" value="00040" />
<option name="presentableId" value="LOCAL-00040" />
<option name="project" value="LOCAL" />
<updated>1608048544558</updated>
</task>
<task id="LOCAL-00041" summary="Improved publisher">
<created>1608049672925</created>
<option name="number" value="00041" />
<option name="presentableId" value="LOCAL-00041" />
<option name="project" value="LOCAL" />
<updated>1608049672925</updated>
</task>
<task id="LOCAL-00042" summary="Published for 2020.12.9">
<created>1608049772153</created>
<option name="number" value="00042" />
<option name="presentableId" value="LOCAL-00042" />
<option name="project" value="LOCAL" />
<updated>1608049772153</updated>
</task>
<task id="LOCAL-00043" summary="Publish improvements for pip install">
<created>1608059323858</created>
<option name="number" value="00043" />
<option name="presentableId" value="LOCAL-00043" />
<option name="project" value="LOCAL" />
<updated>1608059323858</updated>
</task>
<task id="LOCAL-00044" summary="Improved setup.py">
<created>1608059501153</created>
<option name="number" value="00044" />
<option name="presentableId" value="LOCAL-00044" />
<option name="project" value="LOCAL" />
<updated>1608059501153</updated>
</task>
<task id="LOCAL-00045" summary="Added first cli commands">
<created>1608066984496</created>
<option name="number" value="00045" />
<option name="presentableId" value="LOCAL-00045" />
<option name="project" value="LOCAL" />
<updated>1608066984496</updated>
</task>
<task id="LOCAL-00046" summary="Bugfixes and improved setup logic">
<created>1608070231599</created>
<option name="number" value="00046" />
<option name="presentableId" value="LOCAL-00046" />
<option name="project" value="LOCAL" />
<updated>1608070231599</updated>
</task>
<task id="LOCAL-00047" summary="Improved cli">
<created>1608122289003</created>
<option name="number" value="00047" />
<option name="presentableId" value="LOCAL-00047" />
<option name="project" value="LOCAL" />
<updated>1608122289003</updated>
</task>
<task id="LOCAL-00048" summary="Added version command to cli">
<created>1608125743068</created>
<option name="number" value="00048" />
<option name="presentableId" value="LOCAL-00048" />
<option name="project" value="LOCAL" />
<updated>1608125743068</updated>
</task>
<task id="LOCAL-00049" summary="Improved version command &amp; improved help command">
<created>1608127752645</created>
<option name="number" value="00049" />
<option name="presentableId" value="LOCAL-00049" />
<option name="project" value="LOCAL" />
<updated>1608127752645</updated>
</task>
<task id="LOCAL-00050" summary="Improved cli error handling">
<created>1608127998033</created>
<option name="number" value="00050" />
<option name="presentableId" value="LOCAL-00050" />
<option name="project" value="LOCAL" />
<updated>1608127998034</updated>
</task>
<task id="LOCAL-00051" summary="Removed module template">
<created>1608128026922</created>
<option name="number" value="00051" />
<option name="presentableId" value="LOCAL-00051" />
<option name="project" value="LOCAL" />
<updated>1608128026922</updated>
</task>
<task id="LOCAL-00052" summary="Added build command to cli">
<created>1608133651981</created>
<option name="number" value="00052" />
<option name="presentableId" value="LOCAL-00052" />
<option name="project" value="LOCAL" />
<updated>1608133651982</updated>
</task>
<task id="LOCAL-00053" summary="Improved publish process">
<created>1608136663213</created>
<option name="number" value="00053" />
<option name="presentableId" value="LOCAL-00053" />
<option name="project" value="LOCAL" />
<updated>1608136663213</updated>
</task>
<task id="LOCAL-00054" summary="Improved publish process">
<created>1608137669182</created>
<option name="number" value="00054" />
<option name="presentableId" value="LOCAL-00054" />
<option name="project" value="LOCAL" />
<updated>1608137669182</updated>
</task>
<task id="LOCAL-00055" summary="Added publish command to cli">
<created>1608138851088</created>
<option name="number" value="00055" />
<option name="presentableId" value="LOCAL-00055" />
<option name="project" value="LOCAL" />
<updated>1608138851088</updated>
</task>
<task id="LOCAL-00056" summary="Added imports to cli module">
<created>1608138986801</created>
<option name="number" value="00056" />
<option name="presentableId" value="LOCAL-00056" />
<option name="project" value="LOCAL" />
<updated>1608138986801</updated>
</task>
<task id="LOCAL-00057" summary="Improved help command">
<created>1608139067953</created>
<option name="number" value="00057" />
<option name="presentableId" value="LOCAL-00057" />
<option name="project" value="LOCAL" />
<updated>1608139067953</updated>
</task>
<task id="LOCAL-00058" summary="Changed deps">
<created>1608139239527</created>
<option name="number" value="00058" />
<option name="presentableId" value="LOCAL-00058" />
<option name="project" value="LOCAL" />
<updated>1608139239527</updated>
</task>
<task id="LOCAL-00059" summary="Bugfixes">
<created>1608139414722</created>
<option name="number" value="00059" />
<option name="presentableId" value="LOCAL-00059" />
<option name="project" value="LOCAL" />
<updated>1608139414722</updated>
</task>
<task id="LOCAL-00060" summary="Bugfixes">
<created>1608139502304</created>
<option name="number" value="00060" />
<option name="presentableId" value="LOCAL-00060" />
<option name="project" value="LOCAL" />
<updated>1608139502304</updated>
</task>
<task id="LOCAL-00061" summary="Removed publisher.py">
<created>1608139612476</created>
<option name="number" value="00061" />
<option name="presentableId" value="LOCAL-00061" />
<option name="project" value="LOCAL" />
<updated>1608139612476</updated>
</task>
<task id="LOCAL-00062" summary="Added first steps of database command">
<created>1608383809354</created>
<option name="number" value="00062" />
<option name="presentableId" value="LOCAL-00062" />
<option name="project" value="LOCAL" />
<updated>1608383809355</updated>
</task>
<task id="LOCAL-00063" summary="Improved error handling">
<created>1608383870849</created>
<option name="number" value="00063" />
<option name="presentableId" value="LOCAL-00063" />
<option name="project" value="LOCAL" />
<updated>1608383870849</updated>
</task>
<task id="LOCAL-00064" summary="Improved service providing">
<created>1608472168532</created>
<option name="number" value="00064" />
<option name="presentableId" value="LOCAL-00064" />
<option name="project" value="LOCAL" />
<updated>1608472168532</updated>
</task>
<task id="LOCAL-00065" summary="Added email client">
<created>1608472183294</created>
<option name="number" value="00065" />
<option name="presentableId" value="LOCAL-00065" />
<option name="project" value="LOCAL" />
<updated>1608472183294</updated>
</task>
<task id="LOCAL-00066" summary="Published">
<created>1608474022759</created>
<option name="number" value="00066" />
<option name="presentableId" value="LOCAL-00066" />
<option name="project" value="LOCAL" />
<updated>1608474022759</updated>
</task>
<task id="LOCAL-00067" summary="Improved publisher">
<created>1608474032244</created>
<option name="number" value="00067" />
<option name="presentableId" value="LOCAL-00067" />
<option name="project" value="LOCAL" />
<updated>1608474032244</updated>
</task>
<task id="LOCAL-00068" summary="Added imports">
<created>1608474289859</created>
<option name="number" value="00068" />
<option name="presentableId" value="LOCAL-00068" />
<option name="project" value="LOCAL" />
<updated>1608474289859</updated>
</task>
<task id="LOCAL-00069" summary="Removed build form gitignore, added build command">
<created>1608813096023</created>
<option name="number" value="00069" />
<option name="presentableId" value="LOCAL-00069" />
<option name="project" value="LOCAL" />
<updated>1608813096023</updated>
</task>
<task id="LOCAL-00070" summary="Added init file for build command package">
<created>1608813152266</created>
<option name="number" value="00070" />
<option name="presentableId" value="LOCAL-00070" />
<option name="project" value="LOCAL" />
<updated>1608813152266</updated>
</task>
<task id="LOCAL-00071" summary="Added pycharm files to gitignore">
<created>1608822597300</created>
<option name="number" value="00071" />
<option name="presentableId" value="LOCAL-00071" />
<option name="project" value="LOCAL" />
<updated>1608822597311</updated>
</task>
<task id="LOCAL-00072" summary="Added more development tests">
<created>1608823061488</created>
<option name="number" value="00072" />
<option name="presentableId" value="LOCAL-00072" />
<option name="project" value="LOCAL" />
<updated>1608823061489</updated>
</task>
<task id="LOCAL-00073" summary="Added new tester and CredentialManager TestCase">
<created>1608894745271</created>
<option name="number" value="00073" />
<option name="presentableId" value="LOCAL-00073" />
<option name="project" value="LOCAL" />
<updated>1608894745274</updated>
</task>
<task id="LOCAL-00074" summary="Bugfix">
<created>1608896199033</created>
<option name="number" value="00074" />
<option name="presentableId" value="LOCAL-00074" />
<option name="project" value="LOCAL" />
<updated>1608896199034</updated>
</task>
<task id="LOCAL-00075" summary="Added TimeFormatSettings Test">
<created>1608896235005</created>
<option name="number" value="00075" />
<option name="presentableId" value="LOCAL-00075" />
<option name="project" value="LOCAL" />
<updated>1608896235006</updated>
</task>
<task id="LOCAL-00076" summary="Bugfixes">
<created>1608901608928</created>
<option name="number" value="00076" />
<option name="presentableId" value="LOCAL-00076" />
<option name="project" value="LOCAL" />
<updated>1608901608930</updated>
</task>
<task id="LOCAL-00077" summary="Improved tests">
<created>1608921175852</created>
<option name="number" value="00077" />
<option name="presentableId" value="LOCAL-00077" />
<option name="project" value="LOCAL" />
<updated>1608921175853</updated>
</task>
<task id="LOCAL-00078" summary="Bugfixes and improved tests">
<created>1608986131753</created>
<option name="number" value="00078" />
<option name="presentableId" value="LOCAL-00078" />
<option name="project" value="LOCAL" />
<updated>1608986131755</updated>
</task>
<task id="LOCAL-00079" summary="Removed unused packages">
<created>1611431001647</created>
<option name="number" value="00079" />
<option name="presentableId" value="LOCAL-00079" />
<option name="project" value="LOCAL" />
<updated>1611431001649</updated>
</task>
<option name="localTasksCounter" value="80" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Added build command to cli" />
<MESSAGE value="Improved publish process" />
<MESSAGE value="Added publish command to cli" />
<MESSAGE value="Added imports to cli module" />
<MESSAGE value="Improved help command" />
<MESSAGE value="Changed deps" />
<MESSAGE value="Removed publisher.py" />
<MESSAGE value="Added first steps of database command" />
<MESSAGE value="Improved error handling" />
<MESSAGE value="Improved service providing" />
<MESSAGE value="Added email client" />
<MESSAGE value="Published" />
<MESSAGE value="Improved publisher" />
<MESSAGE value="Added imports" />
<MESSAGE value="Removed build form gitignore, added build command" />
<MESSAGE value="Added init file for build command package" />
<MESSAGE value="Added pycharm files to gitignore" />
<MESSAGE value="Added more development tests" />
<MESSAGE value="Added new tester and CredentialManager TestCase" />
<MESSAGE value="Bugfix" />
<MESSAGE value="Added TimeFormatSettings Test" />
<MESSAGE value="Bugfixes" />
<MESSAGE value="Improved tests" />
<MESSAGE value="Bugfixes and improved tests" />
<MESSAGE value="Removed unused packages" />
<option name="LAST_COMMIT_MESSAGE" value="Removed unused packages" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/src/tests/publish_test/publisher_test.py</url>
<line>50</line>
<option name="timeStamp" value="3" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>

View File

@ -5,8 +5,8 @@ from sh_edraft.hosting.application_host import ApplicationHost
from sh_edraft.hosting.base.application_base import ApplicationBase from sh_edraft.hosting.base.application_base import ApplicationBase
from sh_edraft.logging.logger import Logger from sh_edraft.logging.logger import Logger
from sh_edraft.logging.base.logger_base import LoggerBase from sh_edraft.logging.base.logger_base import LoggerBase
from sh_edraft.publishing.publisher import Publisher from sh_edraft.publish.publisher import Publisher
from sh_edraft.publishing.base.publisher_base import PublisherBase from sh_edraft.publish.base.publisher_base import PublisherBase
from sh_edraft.service.providing.base.service_provider_base import ServiceProviderBase from sh_edraft.service.providing.base.service_provider_base import ServiceProviderBase

View File

@ -5,8 +5,8 @@ from sh_edraft.hosting.application_host import ApplicationHost
from sh_edraft.hosting.base.application_base import ApplicationBase from sh_edraft.hosting.base.application_base import ApplicationBase
from sh_edraft.logging.logger import Logger from sh_edraft.logging.logger import Logger
from sh_edraft.logging.base.logger_base import LoggerBase from sh_edraft.logging.base.logger_base import LoggerBase
from sh_edraft.publishing.publisher import Publisher from sh_edraft.publish.publisher import Publisher
from sh_edraft.publishing.base.publisher_base import PublisherBase from sh_edraft.publish.base.publisher_base import PublisherBase
from sh_edraft.service.providing.base.service_provider_base import ServiceProviderBase from sh_edraft.service.providing.base.service_provider_base import ServiceProviderBase

View File

@ -45,6 +45,7 @@ class Console:
@classmethod @classmethod
def set_foreground_color(cls, color: Union[ForegroundColor, str]): def set_foreground_color(cls, color: Union[ForegroundColor, str]):
if type(color) is str: if type(color) is str:
cls._foreground_color = ForegroundColor[color] cls._foreground_color = ForegroundColor[color]
else: else:
@ -66,9 +67,6 @@ class Console:
@classmethod @classmethod
def _output(cls, string: str, x: int = None, y: int = None, end='\n'): def _output(cls, string: str, x: int = None, y: int = None, end='\n'):
if cls._disabled:
return
if cls._is_first_write: if cls._is_first_write:
cls._is_first_write = False cls._is_first_write = False
@ -98,15 +96,21 @@ class Console:
@classmethod @classmethod
def banner(cls, string: str): def banner(cls, string: str):
if cls._disabled:
return
ascii_banner = pyfiglet.figlet_format(string) ascii_banner = pyfiglet.figlet_format(string)
cls.write_line(ascii_banner) cls.write_line(ascii_banner)
@staticmethod @classmethod
def clear(): def clear(cls):
os.system('cls' if os.name == 'nt' else 'clear') os.system('cls' if os.name == 'nt' else 'clear')
@staticmethod @classmethod
def close(): def close(cls):
if cls._disabled:
return
Console.reset() Console.reset()
Console.write('\n\n\nPress any key to continue...') Console.write('\n\n\nPress any key to continue...')
Console.read_line() Console.read_line()
@ -118,6 +122,9 @@ class Console:
@classmethod @classmethod
def error(cls, string: str, tb: str = None): def error(cls, string: str, tb: str = None):
if cls._disabled:
return
cls.set_foreground_color('red') cls.set_foreground_color('red')
if tb is not None: if tb is not None:
cls.write_line(f'{string} -> {tb}') cls.write_line(f'{string} -> {tb}')
@ -138,6 +145,9 @@ class Console:
@classmethod @classmethod
def read_line(cls, output: str = None) -> str: def read_line(cls, output: str = None) -> str:
if cls._disabled:
return ''
if output is not None: if output is not None:
cls.write(output) cls.write(output)
@ -150,6 +160,9 @@ class Console:
@classmethod @classmethod
def table(cls, header: list[str], values: list[list[str]]): def table(cls, header: list[str], values: list[list[str]]):
if cls._disabled:
return
table = tabulate(values, headers=header) table = tabulate(values, headers=header)
Console.write_line(table) Console.write_line(table)
@ -157,16 +170,25 @@ class Console:
@classmethod @classmethod
def write(cls, *args): def write(cls, *args):
if cls._disabled:
return
string = ' '.join(map(str, args)) string = ' '.join(map(str, args))
cls._output(string, end='') cls._output(string, end='')
@classmethod @classmethod
def write_at(cls, x: int, y: int, *args): def write_at(cls, x: int, y: int, *args):
if cls._disabled:
return
string = ' '.join(map(str, args)) string = ' '.join(map(str, args))
cls._output(string, x, y, end='') cls._output(string, x, y, end='')
@classmethod @classmethod
def write_line(cls, *args): def write_line(cls, *args):
if cls._disabled:
return
string = ' '.join(map(str, args)) string = ' '.join(map(str, args))
if not cls._is_first_write: if not cls._is_first_write:
cls._output('') cls._output('')
@ -174,6 +196,9 @@ class Console:
@classmethod @classmethod
def write_line_at(cls, x: int, y: int, *args): def write_line_at(cls, x: int, y: int, *args):
if cls._disabled:
return
string = ' '.join(map(str, args)) string = ' '.join(map(str, args))
if not cls._is_first_write: if not cls._is_first_write:
cls._output('', end='') cls._output('', end='')

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.discord
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.discord'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.messaging
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.messaging'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -2,8 +2,8 @@ import traceback
from typing import Optional from typing import Optional
from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase
from sh_edraft.publishing.model.template import Template from sh_edraft.publish.model.template import Template
from sh_edraft.publishing.model.publish_settings_name import PublishSettingsName from sh_edraft.publish.model.publish_settings_name import PublishSettingsName
from sh_edraft.console.console import Console from sh_edraft.console.console import Console
from sh_edraft.console.model.foreground_color import ForegroundColor from sh_edraft.console.model.foreground_color import ForegroundColor

View File

@ -2,7 +2,7 @@ from typing import Optional
from sh_edraft.coding.model.version import Version from sh_edraft.coding.model.version import Version
from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase
from sh_edraft.publishing.model.template_enum import TemplateEnum from sh_edraft.publish.model.template_enum import TemplateEnum
class Template(ConfigurationModelBase): class Template(ConfigurationModelBase):

View File

@ -5,9 +5,9 @@ from string import Template as stringTemplate
from setuptools import sandbox from setuptools import sandbox
from sh_edraft.logging.base.logger_base import LoggerBase from sh_edraft.logging.base.logger_base import LoggerBase
from sh_edraft.publishing.base.publisher_base import PublisherBase from sh_edraft.publish.base.publisher_base import PublisherBase
from sh_edraft.publishing.model.publish_settings_model import PublishSettings from sh_edraft.publish.model.publish_settings_model import PublishSettings
from sh_edraft.publishing.model.template import Template from sh_edraft.publish.model.template import Template
class Publisher(PublisherBase): class Publisher(PublisherBase):
@ -229,7 +229,7 @@ class Publisher(PublisherBase):
try: try:
if not os.path.isdir(output_path): if not os.path.isdir(output_path):
os.makedirs(output_path) os.makedirs(output_path, exist_ok=True)
except Exception as e: except Exception as e:
self._logger.error(__name__, f'Cannot create directories: {output_path}', e) self._logger.error(__name__, f'Cannot create directories: {output_path}', e)

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.service.model
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.service.model'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
from .provide_state import ProvideState
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -80,16 +80,16 @@ class ServiceProvider(ServiceProviderBase):
def remove_service(self, instance_type: Type[ServiceBase]): def remove_service(self, instance_type: Type[ServiceBase]):
for service in self._transient_services: for service in self._transient_services:
if isinstance(service, type(instance_type)): if service == instance_type and isinstance(self._transient_services[service], type(instance_type)):
del self._transient_services[service] del self._transient_services[service]
return return
for service in self._scoped_services: for service in self._scoped_services:
if isinstance(service, type(instance_type)): if service == instance_type and isinstance(self._scoped_services[service], type(instance_type)):
del self._scoped_services[service] del self._scoped_services[service]
return return
for service in self._singleton_services: for service in self._singleton_services:
if isinstance(service, instance_type): if service == instance_type and isinstance(self._singleton_services[service], instance_type):
del self._singleton_services[service] del self._singleton_services[service]
return return

View File

@ -15,8 +15,6 @@ class TimeFormatSettings(ConfigurationModelBase):
self._time_format: Optional[str] = None self._time_format: Optional[str] = None
self._date_time_format: Optional[str] = None self._date_time_format: Optional[str] = None
self._date_time_log_format: Optional[str] = None self._date_time_log_format: Optional[str] = None
self._os_name: Optional[str] = None
self._hostname: Optional[str] = None
@property @property
def date_format(self) -> str: def date_format(self) -> str:

View File

@ -1,8 +0,0 @@
{
"LoggingSettings": {
"Path": "logs/",
"Filename": "log_$start_time.log",
"ConsoleLogLevel": "TRACE",
"FileLogLevel": "TRACE"
}
}

View File

@ -0,0 +1,20 @@
{
"TimeFormatSettings": {
"DateFormat": "%Y-%m-%d",
"TimeFormat": "%H:%M:%S",
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
},
"LoggingSettings": {
"Path": "logs/",
"Filename": "log_$start_time.log",
"ConsoleLogLevel": "TRACE",
"FileLogLevel": "TRACE"
},
"EMailClientSettings": {
"Host": "mail.sh-edraft.de",
"Port": "587",
"UserName": "dev-srv@sh-edraft.de",
"Credentials": "RmBOQX1eNFYiYjgsSid3fV1nelc2WA=="
}
}

View File

@ -1,8 +1,20 @@
{ {
"TimeFormatSettings": {
"DateFormat": "%Y-%m-%d",
"TimeFormat": "%H:%M:%S",
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
},
"LoggingSettings": { "LoggingSettings": {
"Path": "logs/", "Path": "logs/",
"Filename": "log_$start_time.log", "Filename": "log_$start_time.log",
"ConsoleLogLevel": "TRACE", "ConsoleLogLevel": "TRACE",
"FileLogLevel": "TRACE" "FileLogLevel": "TRACE"
},
"EMailClientSettings": {
"Host": "mail.sh-edraft.de",
"Port": "587",
"UserName": "dev-srv@sh-edraft.de",
"Credentials": "RmBOQX1eNFYiYjgsSid3fV1nelc2WA=="
} }
} }

View File

@ -6,12 +6,9 @@
"FileLogLevel": "TRACE" "FileLogLevel": "TRACE"
}, },
"PublishSettings": { "DatabaseSettings": {
"SourcePath": "../", "ConnectionString": "mysql+mysqlconnector://sh_cpl:$credentials@localhost/sh_cpl",
"DistPath": "../../dist", "Credentials": "MHZhc0Y2bjhKc1VUMWV0Qw==",
"Templates": [], "Encoding": "utf8mb4"
"IncludedFiles": [],
"ExcludedFiles": [],
"TemplateEnding": "_template.txt"
} }
} }

59
src/tests/build.json Normal file
View File

@ -0,0 +1,59 @@
{
"TimeFormatSettings": {
"DateFormat": "%Y-%m-%d",
"TimeFormat": "%H:%M:%S",
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
},
"LoggingSettings": {
"Path": "../../build_test/logs/",
"Filename": "log_$start_time.log",
"ConsoleLogLevel": "INFO",
"FileLogLevel": "TRACE"
},
"PublishSettings": {
"SourcePath": "./",
"DistPath": "../../build_test/dist",
"Templates": [
{
"TemplatePath": "../../publish_templates/all_template.txt",
"Name": "all",
"Description": "",
"LongDescription": "",
"CopyrightDate": "2020",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": ", see LICENSE for more details.",
"Title": "",
"Author": "Sven Heidemann",
"Version": {
"Major": 2020,
"Minor": 12,
"Micro": 10
}
},
{
"TemplatePath": "../../publish_templates/all_template.txt",
"Name": "sh_edraft",
"Description": "common python library",
"LongDescription": "Library to share common classes and models used at sh-edraft.de",
"CopyrightDate": "2020",
"CopyrightName": "sh-edraft.de",
"LicenseName": "MIT",
"LicenseDescription": ", see LICENSE for more details.",
"Title": "",
"Author": "Sven Heidemann",
"Version": {
"Major": 2020,
"Minor": 12,
"Micro": 10
}
}
],
"IncludedFiles": [
],
"ExcludedFiles": [
],
"TemplateEnding": "_template.txt"
}
}

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
"""
tests.configuration
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'tests.configuration'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -1,93 +0,0 @@
import os
import unittest
from typing import cast
from sh_edraft.configuration import Configuration
from sh_edraft.environment.model import EnvironmentName
from sh_edraft.hosting import ApplicationHost
from sh_edraft.logging.model import LoggingSettings, LoggingLevel
from sh_edraft.publishing.model import PublishSettings
from sh_edraft.time.model import TimeFormatSettings
class ConfigTest(unittest.TestCase):
def setUp(self):
self._app_host = ApplicationHost()
self._config = cast(Configuration, self._app_host.configuration)
def test_create(self):
print(f'{__name__}.test_create:')
self.assertIsNotNone(self._config)
self._config.create()
self.assertIsNotNone(self._config)
self.assertEqual(len(self._config._config), 0)
self.assertIsNotNone(self._app_host.application_runtime)
def test_env_vars(self):
print(f'{__name__}.test_env_vars:')
self._config.add_environment_variables('PYTHON_')
self._config.add_environment_variables('CPL_')
def test_arguments(self):
print(f'{__name__}.test_arguments:')
self._config.add_argument_variables()
self.assertEqual(self._config.environment.environment_name, EnvironmentName.testing.value)
def test_appsettings(self):
print(f'{__name__}.test_appsettings:')
self._config.add_json_file(f'appsettings.json')
time_formats: TimeFormatSettings = cast(TimeFormatSettings, self._config.get_configuration(TimeFormatSettings))
self.assertIsNotNone(time_formats)
self.assertEqual(time_formats.date_format, '%Y-%m-%d')
self.assertEqual(time_formats.time_format, '%H:%M:%S')
self.assertEqual(time_formats.date_time_format, '%Y-%m-%d %H:%M:%S.%f')
self.assertEqual(time_formats.date_time_log_format, '%Y-%m-%d_%H-%M-%S')
logging = cast(LoggingSettings, self._config.get_configuration(LoggingSettings))
self.assertIsNotNone(logging)
self.assertEqual(logging.path, 'logs/')
self.assertEqual(logging.filename, 'log_$start_time.log')
self.assertEqual(logging.console.value, LoggingLevel.ERROR.value)
self.assertEqual(logging.level.value, LoggingLevel.WARN.value)
with self.assertRaises(Exception):
publish: PublishSettings = cast(PublishSettings, self._config.get_configuration(PublishSettings))
def test_appsettings_environment(self):
print(f'{__name__}.test_appsettings_environment:')
self._config.add_argument_variables()
self._config.add_json_file(f'appsettings.{self._config.environment.environment_name}.json')
logging = cast(LoggingSettings, self._config.get_configuration(LoggingSettings))
self.assertIsNotNone(logging)
self.assertEqual(logging.path, 'logs/')
self.assertEqual(logging.filename, 'log_$start_time.log')
self.assertEqual(logging.console.value, LoggingLevel.TRACE.value)
self.assertEqual(logging.level.value, LoggingLevel.TRACE.value)
publish: PublishSettings = cast(PublishSettings, self._config.get_configuration(PublishSettings))
self.assertIsNotNone(publish)
self.assertEqual(publish.source_path, '../')
self.assertEqual(publish.dist_path, '../../dist')
self.assertEqual(publish.templates, [])
self.assertEqual(publish.included_files, [])
self.assertEqual(publish.excluded_files, [])
self.assertEqual(publish.template_ending, '_template.txt')
def test_appsettings_host(self):
print(f'{__name__}.test_appsettings_host:')
self._config.add_json_file(f'appsettings.{self._config.environment.host_name}.json')
def test_appsettings_customer(self):
print(f'{__name__}.test_appsettings_customer:')
file_name = f'appsettings.{self._config.environment.customer}.json'
with self.assertRaises(SystemExit):
if os.path.isfile(f'{self._config.environment.content_root_path}/{file_name}'):
os.remove(f'{self._config.environment.content_root_path}/{file_name}')
self._config.add_json_file(file_name)
self._config.add_json_file(file_name, optional=True)

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
"""
tests.hosting
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'tests.hosting'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -1,33 +0,0 @@
import unittest
import datetime
from sh_edraft.configuration.base import ConfigurationBase
from sh_edraft.hosting import ApplicationHost
from sh_edraft.hosting.base import ApplicationRuntimeBase
from sh_edraft.service.base import ServiceProviderBase
class AppHostTest(unittest.TestCase):
def setUp(self):
pass
def test_create(self):
print(f'{__name__}.test_create:')
app_host = ApplicationHost()
self.assertIsNotNone(app_host)
app_host.create()
self.assertIsNotNone(app_host.configuration)
self.assertTrue(isinstance(app_host.configuration, ConfigurationBase))
self.assertIsNotNone(app_host.application_runtime)
self.assertTrue(isinstance(app_host.application_runtime, ApplicationRuntimeBase))
self.assertIsNotNone(app_host.services)
self.assertTrue(isinstance(app_host.services, ServiceProviderBase))
self.assertIsNotNone(app_host._start_time)
self.assertTrue(isinstance(app_host._start_time, datetime.datetime))
self.assertIsNotNone(app_host._end_time)
self.assertTrue(isinstance(app_host._end_time, datetime.datetime))

View File

View File

@ -0,0 +1,52 @@
import os
import unittest
from sh_edraft.console import Console
from sh_edraft.hosting import ApplicationHost
from sh_edraft.logging import Logger
from sh_edraft.logging.base import LoggerBase
from sh_edraft.publish import Publisher
from sh_edraft.publish.base import PublisherBase
from sh_edraft.publish.model import PublishSettings
class PublisherTest(unittest.TestCase):
def setUp(self):
Console.disable()
self._app_host = ApplicationHost()
self._configuration = self._app_host.configuration
self._services = self._app_host.services
self._configuration.add_environment_variables('CPL_')
self._configuration.add_argument_variables()
self._configuration.add_json_file(f'build.json')
self._services.add_singleton(LoggerBase, Logger)
self._services.add_singleton(PublisherBase, Publisher)
self._publisher: Publisher = self._services.get_service(PublisherBase)
def test_include(self):
value = './test.py'
self._publisher.include(value)
self.assertTrue(value in self._publisher._publish_settings.included_files)
def test_exclude(self):
value = './test.py'
self._publisher.exclude(value)
self.assertTrue(value in self._publisher._publish_settings.excluded_files)
def test_create(self):
self._publisher.create()
self.assertTrue(os.path.isdir(self._configuration.get_configuration(PublishSettings).dist_path))
def test_build(self):
self._publisher.create()
self._publisher.build()
self.assertTrue(os.path.isdir(self._configuration.get_configuration(PublishSettings).dist_path))
def test_publish(self):
self._publisher.create()
self._publisher.build()
self._publisher.publish()
self.assertTrue(os.path.isdir(self._configuration.get_configuration(PublishSettings).dist_path))

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
"""
tests.service_providing
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'tests.service_providing'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -1,136 +0,0 @@
import unittest
from typing import cast
from sh_edraft.hosting import ApplicationHost
from sh_edraft.logging import Logger
from sh_edraft.logging.base import LoggerBase
from sh_edraft.publishing import Publisher
from sh_edraft.publishing.base import PublisherBase
from sh_edraft.service import ServiceProvider
from sh_edraft.service.base import ServiceBase
class ServiceProviderTest(unittest.TestCase):
def setUp(self):
self._app_host = ApplicationHost()
self._config = self._app_host.configuration
self._config.create()
self._config.add_environment_variables('PYTHON_')
self._config.add_environment_variables('CPL_')
self._config.add_argument_variables()
self._config.add_json_file(f'appsettings.json')
self._config.add_json_file(f'appsettings.{self._config.environment.environment_name}.json')
self._config.add_json_file(f'appsettings.{self._config.environment.host_name}.json', optional=True)
self._services: ServiceProvider = cast(ServiceProvider, self._app_host.services)
self._services.create()
def _check_general_requirements(self):
self.assertIsNotNone(self._services)
def _add_logger(self):
self._services.add_singleton(LoggerBase, Logger)
logger: Logger = self._services.get_service(LoggerBase)
logger.create()
def test_create(self):
print(f'{__name__}.test_create:')
provider = ServiceProvider(self._app_host.application_runtime)
self.assertIsNotNone(provider)
provider.create()
self.assertIsNotNone(provider)
def test_add_singleton(self):
print(f'{__name__}.test_add_singleton:')
self._check_general_requirements()
self._services.add_singleton(LoggerBase, Logger)
self.assertGreater(len(self._services._singleton_services), 0)
found = False
for service_type in self._services._singleton_services:
service = self._services._singleton_services[service_type]
if service_type == LoggerBase and (
isinstance(service, Logger) and
isinstance(service, LoggerBase) and
isinstance(service, ServiceBase)
):
if not found:
found = True
self.assertTrue(found)
found = False
for service_type in self._services._singleton_services:
service = self._services._singleton_services[service_type]
if service_type == PublisherBase and (
isinstance(service, Publisher) and
isinstance(service, PublisherBase) and
isinstance(service, ServiceBase)
):
if not found:
found = True
self.assertFalse(found)
def test_get_singleton(self):
print(f'{__name__}.test_get_singleton:')
self._check_general_requirements()
self._services.add_singleton(LoggerBase, Logger)
logger: Logger = self._services.get_service(LoggerBase)
self.assertIsNotNone(logger)
self.assertTrue(isinstance(logger, Logger))
self.assertTrue(isinstance(logger, LoggerBase))
self.assertTrue(isinstance(logger, ServiceBase))
self.assertEqual(logger._app_runtime, self._app_host.application_runtime)
def test_add_scoped(self):
print(f'{__name__}.test_add_scoped:')
self._check_general_requirements()
self._add_logger()
self._services.add_scoped(PublisherBase, Publisher)
def test_get_scoped(self):
print(f'{__name__}.test_get_scoped:')
self._check_general_requirements()
self._add_logger()
self._services.add_scoped(PublisherBase, Publisher)
publisher: Publisher = self._services.get_service(PublisherBase)
self.assertIsNotNone(publisher)
self.assertTrue(isinstance(publisher, Publisher))
self.assertTrue(isinstance(publisher, PublisherBase))
self.assertTrue(isinstance(publisher, ServiceBase))
self.assertTrue(isinstance(publisher._logger, Logger))
self.assertTrue(isinstance(publisher._logger, LoggerBase))
self.assertTrue(isinstance(publisher._logger, ServiceBase))
def test_add_transient(self):
print(f'{__name__}.test_add_transient:')
self._check_general_requirements()
self._add_logger()
self._services.add_transient(PublisherBase, Publisher)
self.assertGreater(len(self._services._transient_services), 0)
self.assertTrue(bool(isinstance(service, ServiceBase) for service in self._services._transient_services))
def test_get_transient(self):
print(f'{__name__}.test_get_transient:')
self._check_general_requirements()
self._add_logger()
self._services.add_transient(PublisherBase, Publisher)
publisher: Publisher = self._services.get_service(PublisherBase)
self.assertIsNotNone(publisher)
self.assertTrue(isinstance(publisher, Publisher))
self.assertTrue(isinstance(publisher, PublisherBase))
self.assertTrue(isinstance(publisher, ServiceBase))
self.assertTrue(isinstance(publisher._logger, Logger))
self.assertTrue(isinstance(publisher._logger, LoggerBase))
self.assertTrue(isinstance(publisher._logger, ServiceBase))

View File

View File

@ -0,0 +1,79 @@
import unittest
from sh_edraft.console import Console
from sh_edraft.database.context import DatabaseContext
from sh_edraft.hosting import ApplicationHost
from sh_edraft.logging import Logger
from sh_edraft.logging.base import LoggerBase
class ProviderTest(unittest.TestCase):
def setUp(self):
Console.disable()
self._app_host = ApplicationHost()
self._configuration = self._app_host.configuration
self._services = self._app_host.services
self._configuration.add_environment_variables('CPL_')
self._configuration.add_argument_variables()
self._configuration.add_json_file(f'appsettings.json')
self._configuration.add_json_file(f'appsettings.{self._configuration.environment.environment_name}.json')
self._configuration.add_json_file(f'appsettings.{self._configuration.environment.host_name}.json', optional=True)
def test_get_db_context(self):
self._services.add_db_context(DatabaseContext)
db: DatabaseContext = self._services.get_db_context()
self.assertIsNotNone(db)
def test_get_service_singleton(self):
self._services.add_singleton(LoggerBase, Logger)
logger = self._services.get_service(LoggerBase)
self.assertIsNotNone(logger)
def test_get_service_scoped(self):
self._services.add_scoped(LoggerBase, Logger)
logger = self._services.get_service(LoggerBase)
self.assertIsNotNone(logger)
def test_get_service_transient(self):
self._services.add_transient(LoggerBase, Logger)
logger = self._services.get_service(LoggerBase)
self.assertIsNotNone(logger)
def test_remove_service_singleton(self):
self._services.add_singleton(LoggerBase, Logger)
logger = self._services.get_service(LoggerBase)
self.assertIsNotNone(logger)
self._services.remove_service(LoggerBase)
logger = self._services.get_service(LoggerBase)
self.assertIsNone(logger)
def test_remove_service_scoped(self):
self._services.add_scoped(LoggerBase, Logger)
logger = self._services.get_service(LoggerBase)
self.assertIsNotNone(logger)
self._services.remove_service(LoggerBase)
logger = self._services.get_service(LoggerBase)
self.assertIsNone(logger)
def test_remove_service_transient(self):
self._services.add_transient(LoggerBase, Logger)
logger = self._services.get_service(LoggerBase)
self.assertIsNotNone(logger)
self._services.remove_service(LoggerBase)
logger = self._services.get_service(LoggerBase)
self.assertIsNone(logger)

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
"""
tests.services
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'tests.services'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
"""
tests.services.logging
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'tests.services.logging'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -1,206 +0,0 @@
import os
import shutil
import unittest
from string import Template
from typing import cast
from sh_edraft.hosting import ApplicationHost
from sh_edraft.logging import Logger
from sh_edraft.logging.model import LoggingSettings
from sh_edraft.service import ServiceProvider
from sh_edraft.time.model import TimeFormatSettings
class LoggerTest(unittest.TestCase):
def setUp(self):
self._app_host = ApplicationHost()
self._config = self._app_host.configuration
self._config.create()
self._config.add_environment_variables('PYTHON_')
self._config.add_environment_variables('CPL_')
self._config.add_argument_variables()
self._config.add_json_file(f'appsettings.json')
self._config.add_json_file(f'appsettings.{self._config.environment.environment_name}.json')
self._config.add_json_file(f'appsettings.{self._config.environment.host_name}.json', optional=True)
self._services: ServiceProvider = cast(ServiceProvider, self._app_host.services)
self._services.create()
self._app_runtime = self._app_host.application_runtime
self._log_settings: LoggingSettings = self._config.get_configuration(LoggingSettings)
self._time_format_settings: TimeFormatSettings = self._config.get_configuration(TimeFormatSettings)
def tearDown(self):
if os.path.isdir(self._log_settings.path):
shutil.rmtree(self._log_settings.path)
def _check_general_requirements(self):
self.assertIsNotNone(self._log_settings)
self.assertIsNotNone(self._time_format_settings)
def test_create(self):
print(f'{__name__}.test_create:')
logger = Logger(self._log_settings, self._time_format_settings, self._app_runtime)
logger.create()
self.assertTrue(os.path.isdir(self._log_settings.path))
log_file = Template(self._log_settings.filename).substitute(
date_time_now=self._app_runtime.date_time_now.strftime(self._time_format_settings.date_time_format),
start_time=self._app_runtime.start_time.strftime(self._time_format_settings.date_time_log_format)
)
self.assertTrue(os.path.isfile(self._log_settings.path + log_file))
def test_header(self):
print(f'{__name__}.test_header:')
logger = Logger(self._log_settings, self._time_format_settings, self._app_runtime)
logger.create()
logger.header('HeaderTest:')
log_file = Template(self._log_settings.filename).substitute(
date_time_now=self._app_runtime.date_time_now.strftime(self._time_format_settings.date_time_format),
start_time=self._app_runtime.start_time.strftime(self._time_format_settings.date_time_log_format)
)
log_content = []
try:
with open(self._log_settings.path + log_file, "r") as log:
log_content = log.readlines()
log.close()
except Exception as e:
print('Cannot open log file', e)
self.assertGreater(len(log_content), 0)
self.assertEqual(log_content[len(log_content) - 1], 'HeaderTest:\n')
def test_trace(self):
print(f'{__name__}.test_trace:')
logger = Logger(self._log_settings, self._time_format_settings, self._app_runtime)
logger.create()
logger.trace(__name__, f'{__name__}.test_trace:')
log_file = Template(self._log_settings.filename).substitute(
date_time_now=self._app_runtime.date_time_now.strftime(self._time_format_settings.date_time_format),
start_time=self._app_runtime.start_time.strftime(self._time_format_settings.date_time_log_format)
)
log_content = []
try:
with open(self._log_settings.path + log_file, "r") as log:
log_content = log.readlines()
log.close()
except Exception as e:
print('Cannot open log file', e)
self.assertGreater(len(log_content), 0)
self.assertTrue(log_content[len(log_content) - 1].endswith(f'[ TRACE ] [ {__name__} ]: {__name__}.test_trace:\n'))
def test_debug(self):
print(f'{__name__}.test_debug:')
logger = Logger(self._log_settings, self._time_format_settings, self._app_runtime)
logger.create()
logger.debug(__name__, f'{__name__}.test_debug:')
log_file = Template(self._log_settings.filename).substitute(
date_time_now=self._app_runtime.date_time_now.strftime(self._time_format_settings.date_time_format),
start_time=self._app_runtime.start_time.strftime(self._time_format_settings.date_time_log_format)
)
log_content = []
try:
with open(self._log_settings.path + log_file, "r") as log:
log_content = log.readlines()
log.close()
except Exception as e:
print('Cannot open log file', e)
self.assertGreater(len(log_content), 0)
self.assertTrue(log_content[len(log_content) - 1].endswith(f'[ DEBUG ] [ {__name__} ]: {__name__}.test_debug:\n'))
def test_info(self):
print(f'{__name__}.test_info:')
logger = Logger(self._log_settings, self._time_format_settings, self._app_runtime)
logger.create()
logger.info(__name__, f'{__name__}.test_info:')
log_file = Template(self._log_settings.filename).substitute(
date_time_now=self._app_runtime.date_time_now.strftime(self._time_format_settings.date_time_format),
start_time=self._app_runtime.start_time.strftime(self._time_format_settings.date_time_log_format)
)
log_content = []
try:
with open(self._log_settings.path + log_file, "r") as log:
log_content = log.readlines()
log.close()
except Exception as e:
print('Cannot open log file', e)
self.assertGreater(len(log_content), 0)
self.assertTrue(log_content[len(log_content) - 1].endswith(f'[ INFO ] [ {__name__} ]: {__name__}.test_info:\n'))
def test_warn(self):
print(f'{__name__}.test_warn:')
logger = Logger(self._log_settings, self._time_format_settings, self._app_runtime)
logger.create()
logger.warn(__name__, f'{__name__}.test_warn:')
log_file = Template(self._log_settings.filename).substitute(
date_time_now=self._app_runtime.date_time_now.strftime(self._time_format_settings.date_time_format),
start_time=self._app_runtime.start_time.strftime(self._time_format_settings.date_time_log_format)
)
log_content = []
try:
with open(self._log_settings.path + log_file, "r") as log:
log_content = log.readlines()
log.close()
except Exception as e:
print('Cannot open log file', e)
self.assertGreater(len(log_content), 0)
self.assertTrue(log_content[len(log_content) - 1].endswith(f'[ WARN ] [ {__name__} ]: {__name__}.test_warn:\n'))
def test_error(self):
print(f'{__name__}.test_error:')
logger = Logger(self._log_settings, self._time_format_settings, self._app_runtime)
logger.create()
logger.error(__name__, f'{__name__}.test_error:')
log_file = Template(self._log_settings.filename).substitute(
date_time_now=self._app_runtime.date_time_now.strftime(self._time_format_settings.date_time_format),
start_time=self._app_runtime.start_time.strftime(self._time_format_settings.date_time_log_format)
)
log_content = []
try:
with open(self._log_settings.path + log_file, "r") as log:
log_content = log.readlines()
log.close()
except Exception as e:
print('Cannot open log file', e)
self.assertGreater(len(log_content), 0)
self.assertTrue(log_content[len(log_content) - 1].endswith(f'[ ERROR ] [ {__name__} ]: {__name__}.test_error:\n'))
def test_fatal(self):
print(f'{__name__}.test_fatal:')
logger = Logger(self._log_settings, self._time_format_settings, self._app_runtime)
logger.create()
with self.assertRaises(SystemExit):
logger.fatal(__name__, f'{__name__}.test_fatal:')
log_file = Template(self._log_settings.filename).substitute(
date_time_now=self._app_runtime.date_time_now.strftime(self._time_format_settings.date_time_format),
start_time=self._app_runtime.start_time.strftime(self._time_format_settings.date_time_log_format)
)
log_content = []
try:
with open(self._log_settings.path + log_file, "r") as log:
log_content = log.readlines()
log.close()
except Exception as e:
print('Cannot open log file', e)
self.assertGreater(len(log_content), 0)
self.assertTrue(log_content[len(log_content) - 1].endswith(f'[ FATAL ] [ {__name__} ]: {__name__}.test_fatal:\n'))

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
"""
tests.services.publishing
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2020 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = 'tests.services.publishing'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'
__version__ = '2020.12.9'
from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=9)

View File

@ -1,92 +0,0 @@
import os
import shutil
import unittest
from sh_edraft.hosting import ApplicationHost
from sh_edraft.logging import Logger
from sh_edraft.logging.model import LoggingSettings
from sh_edraft.publishing import Publisher
from sh_edraft.publishing.model import Template
from sh_edraft.publishing.model import PublishSettings
from sh_edraft.coding.model import Version
from sh_edraft.time.model import TimeFormatSettings
class PublisherTest(unittest.TestCase):
def _configure(self):
self._version = Version(2020, 12, 5)
templates = [
Template(
'../../publish_templates/all_template.txt',
'all',
'',
'',
'2020',
'sh-edraft.de',
'MIT',
', see LICENSE for more details.',
'',
'Sven Heidemann',
self._version
),
Template(
'../../publish_templates/all_template.txt',
'sh_edraft',
'common python library',
'Library to share common classes and models used at sh-edraft.de',
'2020',
'sh-edraft.de',
'MIT',
', see LICENSE for more details.',
'',
'Sven Heidemann',
self._version
)
]
self._source_path = '../'
self._dist_path = '../../dist'
self._publish_settings_model = PublishSettings()
self._publish_settings_model.from_dict({
"SourcePath": self._source_path,
"DistPath": self._dist_path,
"Templates": templates,
"IncludedFiles": [],
"ExcludedFiles": [],
"TemplateEnding": "_template.txt",
})
def setUp(self):
self._app_host = ApplicationHost()
self._config = self._app_host.configuration
self._config.create()
self._config.add_environment_variables('PYTHON_')
self._config.add_environment_variables('CPL_')
self._config.add_argument_variables()
self._config.add_json_file(f'appsettings.json')
self._config.add_json_file(f'appsettings.{self._config.environment.environment_name}.json')
self._config.add_json_file(f'appsettings.{self._config.environment.host_name}.json', optional=True)
self._app_runtime = self._app_host.application_runtime
self._configure()
self._log_settings: LoggingSettings = self._config.get_configuration(LoggingSettings)
self._time_format_settings: TimeFormatSettings = self._config.get_configuration(TimeFormatSettings)
self._logger = Logger(self._log_settings, self._time_format_settings, self._app_host.application_runtime)
self._logger.create()
def tearDown(self):
if os.path.isdir(self._log_settings.path):
shutil.rmtree(self._log_settings.path)
def test_create(self):
print(f'{__name__}.test_create:')
publisher: Publisher = Publisher(self._logger, self._publish_settings_model)
self.assertIsNotNone(publisher)
publisher.create()
self.assertTrue(os.path.isdir(self._dist_path))
self.assertEqual(publisher._publish_settings, self._publish_settings_model)

24
src/tests/setup.py Normal file
View File

@ -0,0 +1,24 @@
import setuptools
setuptools.setup(
name='sh_edraft_unittests',
version='2020.0.1',
packages=setuptools.find_packages(exclude=["tests*"]),
url='https://www.sh-edraft.de',
license='MIT',
author='Sven Heidemann',
author_email='edraft.sh@gmail.com',
include_package_data=True,
description='sh-edraft python common lib unittest',
python_requires='>=3.8',
install_requires=[
'discord.py',
'flask',
'mysql-connector',
'SQLAlchemy',
'termcolor',
'pyfiglet',
'tabulate',
'smtplib'
]
)

View File

@ -1,59 +0,0 @@
import unittest
from tests.configuration.config import ConfigTest
from tests.hosting.app_host import AppHostTest
from tests.services.logging.logger import LoggerTest
from tests.services.publishing.publisher import PublisherTest
from tests.service_providing.service_provider import ServiceProviderTest
class Tester:
def __init__(self):
self._suite = unittest.TestSuite()
def create(self):
# hosting app host
self._suite.addTest(AppHostTest('test_create'))
# configuration
self._suite.addTest(ConfigTest('test_create'))
self._suite.addTest(ConfigTest('test_env_vars'))
self._suite.addTest(ConfigTest('test_arguments'))
self._suite.addTest(ConfigTest('test_appsettings'))
self._suite.addTest(ConfigTest('test_appsettings_environment'))
self._suite.addTest(ConfigTest('test_appsettings_host'))
self._suite.addTest(ConfigTest('test_appsettings_customer'))
# providing
self._suite.addTest(ServiceProviderTest('test_create'))
self._suite.addTest(ServiceProviderTest('test_add_singleton'))
self._suite.addTest(ServiceProviderTest('test_get_singleton'))
self._suite.addTest(ServiceProviderTest('test_add_scoped'))
self._suite.addTest(ServiceProviderTest('test_get_scoped'))
self._suite.addTest(ServiceProviderTest('test_add_transient'))
self._suite.addTest(ServiceProviderTest('test_get_transient'))
# logging
self._suite.addTest(LoggerTest('test_create'))
self._suite.addTest(LoggerTest('test_header'))
self._suite.addTest(LoggerTest('test_trace'))
self._suite.addTest(LoggerTest('test_debug'))
self._suite.addTest(LoggerTest('test_info'))
self._suite.addTest(LoggerTest('test_warn'))
self._suite.addTest(LoggerTest('test_error'))
self._suite.addTest(LoggerTest('test_fatal'))
# publishing
self._suite.addTest(PublisherTest('test_create'))
def start(self):
runner = unittest.TextTestRunner()
runner.run(self._suite)
# unittest.main()
if __name__ == '__main__':
tester = Tester()
tester.create()
tester.start()

View File

View File

@ -0,0 +1,26 @@
import unittest
from sh_edraft.time.model import TimeFormatSettingsNames, TimeFormatSettings
class TimeFormatSettingsTest(unittest.TestCase):
def setUp(self): pass
def test_from_dict(self):
test_dict = {
TimeFormatSettingsNames.date_format.value: '%H:%M:%S',
TimeFormatSettingsNames.time_format.value: '%Y-%m-%d',
TimeFormatSettingsNames.date_time_format.value: '%Y-%m-%d %H:%M:%S.%f',
TimeFormatSettingsNames.date_time_log_format.value: '%Y-%m-%d_%H-%M-%S'
}
settings = TimeFormatSettings()
settings.from_dict(test_dict)
self.assertIsNotNone(settings)
self.assertEqual(test_dict[TimeFormatSettingsNames.date_format.value], settings.date_format)
self.assertEqual(test_dict[TimeFormatSettingsNames.time_format.value], settings.time_format)
self.assertEqual(test_dict[TimeFormatSettingsNames.date_time_format.value], settings.date_time_format)
self.assertEqual(test_dict[TimeFormatSettingsNames.date_time_log_format.value], settings.date_time_log_format)

View File

View File

@ -0,0 +1,37 @@
import base64
import unittest
from sh_edraft.utils import CredentialManager
class CredentialManagerTest(unittest.TestCase):
def setUp(self): pass
def test_encode(self):
test_string = 'Hello World'
expected_test_result = base64.b64encode(test_string.encode('utf-8')).decode('utf-8')
test_result = CredentialManager.encrypt(test_string)
self.assertIsNotNone(test_result)
self.assertEqual(expected_test_result, test_result)
def test_decode(self):
test_string = 'SGVsbG8gV29ybGQ='
expected_test_result = base64.b64decode(test_string).decode('utf-8')
test_result = CredentialManager.decrypt(test_string)
self.assertIsNotNone(test_result)
self.assertEqual(expected_test_result, test_result)
def test_build_string(self):
test_string = 'String is $credentials'
test_credentials = 'SGVsbG8gV29ybGQ='
expected_test_result = test_string.replace('$credentials', base64.b64decode(test_credentials).decode('utf-8'))
test_result = CredentialManager.build_string(test_string, test_credentials)
self.assertIsNotNone(test_result)
self.assertEqual(expected_test_result, test_result)

View File

@ -74,7 +74,6 @@ class Program(ApplicationBase):
Console.write_line('Hello World') Console.write_line('Hello World')
Console.write('\nName: ') Console.write('\nName: ')
Console.write_line('Hello', Console.read_line()) Console.write_line('Hello', Console.read_line())
Console
Console.clear() Console.clear()
Console.write_at(5, 5, 'at 5, 5') Console.write_at(5, 5, 'at 5, 5')
Console.write_at(10, 10, 'at 10, 10') Console.write_at(10, 10, 'at 10, 10')