Added first publisher tests, fixed small bugs

This commit is contained in:
2020-11-24 19:53:24 +01:00
parent 45154950ee
commit cd9d4d3c3d
14 changed files with 118 additions and 72 deletions

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.messenger
sh_edraft.messaging
~~~~~~~~~~~~~~~~~~~
@@ -11,7 +11,7 @@ sh_edraft.messenger
"""
__title__ = 'sh_edraft.messenger'
__title__ = 'sh_edraft.messaging'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.publish
sh_edraft.publishing
~~~~~~~~~~~~~~~~~~~
@@ -11,7 +11,7 @@ sh_edraft.publish
"""
__title__ = 'sh_edraft.publish'
__title__ = 'sh_edraft.publishing'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.publish.base
sh_edraft.publishing.base
~~~~~~~~~~~~~~~~~~~
@@ -11,7 +11,7 @@ sh_edraft.publish.base
"""
__title__ = 'sh_edraft.publish.base'
__title__ = 'sh_edraft.publishing.base'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

@@ -2,7 +2,7 @@ from abc import abstractmethod
from typing import Optional
from sh_edraft.logging.base.logger_base import LoggerBase
from sh_edraft.publish.model.template import Template
from sh_edraft.publishing.model.template import Template
from sh_edraft.service.base.service_base import ServiceBase

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
sh_edraft.publish.model
sh_edraft.publishing.model
~~~~~~~~~~~~~~~~~~~
@@ -11,7 +11,7 @@ sh_edraft.publish.model
"""
__title__ = 'sh_edraft.publish.model'
__title__ = 'sh_edraft.publishing.model'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 sh-edraft.de'

View File

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

View File

@@ -3,8 +3,8 @@ import shutil
from string import Template as stringTemplate
from sh_edraft.logging.base.logger_base import LoggerBase
from sh_edraft.publish.base.publisher_base import PublisherBase
from sh_edraft.publish.model.template import Template
from sh_edraft.publishing.base.publisher_base import PublisherBase
from sh_edraft.publishing.model.template import Template
class Publisher(PublisherBase):
@@ -66,13 +66,13 @@ class Publisher(PublisherBase):
for t in self._settings:
output_template: str = ''
if not os.path.isfile(t.template_path):
raise Exception(f'Template not found: {t.template_path}')
self._logger.fatal(__name__, f'Template not found: {t.template_path}')
with open(t.template_path) as template:
t.file_content = template.read()
template.close()
if t.file_content == '':
raise Exception(f'Template is empty: {t.template_path}')
self._logger.fatal(__name__, f'Template is empty: {t.template_path}')
self._logger.trace(__name__, f'Stopped {__name__}._read_templates')