Ulrich
2 years ago
20 changed files with 345 additions and 59 deletions
@ -0,0 +1,41 @@ |
|||
# --------------------------------------------------------------------------------------------------------- |
|||
# Author : Ulrich Carmesin |
|||
# Source : gitea.ucarmesin.de |
|||
# --------------------------------------------------------------------------------------------------------- |
|||
import os |
|||
import basic.constants as B |
|||
import model.entity |
|||
import tools.path_const as P |
|||
import tools.config_tool |
|||
import tools.file_tool |
|||
import tools.git_tool |
|||
|
|||
TABLE_NAMES = ["environment", "en_project", "en_component"] |
|||
DEFAULT_SYNC = model.entity.SYNC_FULL_GIT2DB |
|||
|
|||
def select_environments(job, projectList): |
|||
""" |
|||
searches and gets environments in which the applications of the project are declared that these are installed |
|||
filtered by parameter --environment |
|||
:param job: |
|||
:return: |
|||
""" |
|||
environments = {} |
|||
path = job.conf[B.SUBJECT_PATH][B.ATTR_PATH_ENV] |
|||
if not os.path.exists(path): |
|||
raise Exception("Umgebungsverzeichnis existiert nicht "+path) |
|||
for envdir in os.listdir(path): |
|||
if not os.path.isdir(os.path.join(path, envdir)): |
|||
continue |
|||
if envdir[0:1] == "_": |
|||
continue |
|||
try: |
|||
pathname = tools.config_tool.select_config_path(job, P.KEY_TOOL, "conn", envdir) |
|||
doc = tools.file_tool.read_file_dict(job, pathname, job.m) |
|||
for proj in doc[B.SUBJECT_ENV][B.CONF_NODE_GENERAL][B.SUBJECT_PROJECTS]: |
|||
if proj in projectList: |
|||
environments[envdir] = doc[B.SUBJECT_ENV][B.CONF_NODE_GENERAL] |
|||
except: |
|||
continue |
|||
return environments |
|||
|
@ -0,0 +1,40 @@ |
|||
import unittest |
|||
import os |
|||
import inspect |
|||
import shutil |
|||
|
|||
import tools.path_tool |
|||
import basic.program |
|||
import test.testtools |
|||
import basic.constants as B |
|||
import test.constants as T |
|||
import tools.file_tool |
|||
import model.application |
|||
|
|||
HOME_PATH = test.constants.HOME_PATH |
|||
PYTHON_CMD = "python" |
|||
TEST_FUNCTIONS = ["test_10getApplications"] |
|||
|
|||
PROGRAM_NAME = "clean_workspace" |
|||
|
|||
class MyTestCase(unittest.TestCase): |
|||
mymsg = "--------------------------------------------------------------" |
|||
|
|||
def test_10getApplications(self): |
|||
global mymsg |
|||
global jobObject |
|||
actfunction = str(inspect.currentframe().f_code.co_name) |
|||
cnttest = 0 |
|||
if actfunction not in TEST_FUNCTIONS: |
|||
return |
|||
# simple job instantiate - without parameter and only simple messaging |
|||
job = test.testtools.getJob() |
|||
print(str(job.__dict__)) |
|||
jobObject = job |
|||
projList = ["TESTPROJ"] |
|||
apps = model.application.select_applications(job, projList) |
|||
print(str(apps)) |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
unittest.main() |
@ -0,0 +1,41 @@ |
|||
import unittest |
|||
import os |
|||
import inspect |
|||
import shutil |
|||
|
|||
import tools.path_tool |
|||
import basic.program |
|||
import test.testtools |
|||
import basic.constants as B |
|||
import test.constants as T |
|||
import tools.file_tool |
|||
import model.environment |
|||
|
|||
HOME_PATH = test.constants.HOME_PATH |
|||
PYTHON_CMD = "python" |
|||
TEST_FUNCTIONS = ["test_10getEnvironments"] |
|||
|
|||
PROGRAM_NAME = "clean_workspace" |
|||
|
|||
class MyTestCase(unittest.TestCase): |
|||
mymsg = "--------------------------------------------------------------" |
|||
|
|||
def test_10getEnvironments(self): |
|||
global mymsg |
|||
global jobObject |
|||
actfunction = str(inspect.currentframe().f_code.co_name) |
|||
cnttest = 0 |
|||
if actfunction not in TEST_FUNCTIONS: |
|||
return |
|||
# simple job instantiate - without parameter and only simple messaging |
|||
job = test.testtools.getJob() |
|||
print(str(job.__dict__)) |
|||
jobObject = job |
|||
projList = ["TESTPROJ"] |
|||
envs = model.environment.select_environments(job, projList) |
|||
print(str(envs)) |
|||
print(str(envs.keys())) |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
unittest.main() |
@ -0,0 +1,41 @@ |
|||
import unittest |
|||
import os |
|||
import inspect |
|||
import shutil |
|||
|
|||
import tools.path_tool |
|||
import basic.program |
|||
import test.testtools |
|||
import basic.constants as B |
|||
import test.constants as T |
|||
import tools.file_tool |
|||
import model.testsuite |
|||
|
|||
HOME_PATH = test.constants.HOME_PATH |
|||
PYTHON_CMD = "python" |
|||
TEST_FUNCTIONS = ["test_10getEnvironments"] |
|||
|
|||
PROGRAM_NAME = "clean_workspace" |
|||
|
|||
class MyTestCase(unittest.TestCase): |
|||
mymsg = "--------------------------------------------------------------" |
|||
|
|||
def test_10getEnvironments(self): |
|||
global mymsg |
|||
global jobObject |
|||
actfunction = str(inspect.currentframe().f_code.co_name) |
|||
cnttest = 0 |
|||
if actfunction not in TEST_FUNCTIONS: |
|||
return |
|||
# simple job instantiate - without parameter and only simple messaging |
|||
job = test.testtools.getJob() |
|||
print(str(job.__dict__)) |
|||
jobObject = job |
|||
projList = ["TESTPROJ"] |
|||
appList = [] |
|||
envs = model.testsuite.select_testsuites(job, projList, appList) |
|||
print(str(envs)) |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
unittest.main() |
Loading…
Reference in new issue