diff --git a/tests/base.py b/tests/base.py index e58a56e3a..c58c48976 100644 --- a/tests/base.py +++ b/tests/base.py @@ -25,6 +25,10 @@ import testtools import xml.etree.ElementTree as XML import yaml from jenkins_jobs.builder import XmlJob, YamlParser, ModuleRegistry +from jenkins_jobs.modules import (project_flow, + project_matrix, + project_maven, + project_multijob) def get_scenarios(fixtures_path): @@ -75,21 +79,21 @@ class BaseTestCase(object): return yaml_content, expected_xml = self.__read_content() - - root_element = XML.Element('project') + project = None if ('project-type' in yaml_content): if (yaml_content['project-type'] == "maven"): - root_element = XML.Element('maven2-moduleset') - if (yaml_content['project-type'] == "matrix"): - root_element = XML.Element('matrix-project') - if (yaml_content['project-type'] == "flow"): - root_element = XML.Element('com.cloudbees.plugins.flow.' - 'BuildFlow') - if (yaml_content['project-type'] == "multijob"): - root_element = XML.Element('com.tikal.jenkins.plugins.' - 'multijob.MultiJobProject') + project = project_maven.Maven(None) + elif (yaml_content['project-type'] == "matrix"): + project = project_matrix.Matrix(None) + elif (yaml_content['project-type'] == "flow"): + project = project_flow.Flow(None) + elif (yaml_content['project-type'] == "multijob"): + project = project_multijob.MultiJob(None) - xml_project = root_element + if project: + xml_project = project.root_xml(yaml_content) + else: + xml_project = XML.Element('project') parser = YamlParser() pub = self.klass(ModuleRegistry({})) diff --git a/tests/general/fixtures/project-maven001.xml b/tests/general/fixtures/project-maven001.xml new file mode 100644 index 000000000..0a1ccbc6f --- /dev/null +++ b/tests/general/fixtures/project-maven001.xml @@ -0,0 +1,31 @@ + + + + gabba.gabba + hey + + deploy + true + pom.xml + true + false + true + false + false + false + -1 + false + + + + FAILURE + 2 + red + + + false + false + false + false + true + diff --git a/tests/general/fixtures/project-maven001.yaml b/tests/general/fixtures/project-maven001.yaml new file mode 100644 index 000000000..52b8763c5 --- /dev/null +++ b/tests/general/fixtures/project-maven001.yaml @@ -0,0 +1,7 @@ +project-type: maven +maven: + root-pom: pom.xml + goals: deploy + root-module: + group-id: gabba.gabba + artifact-id: hey diff --git a/tests/general/fixtures/project-type002.xml b/tests/general/fixtures/project-type002.xml index 6c237064c..ede8bc0a6 100644 --- a/tests/general/fixtures/project-type002.xml +++ b/tests/general/fixtures/project-type002.xml @@ -1,5 +1,10 @@ + + false + + + false false diff --git a/tests/general/fixtures/project-type003.xml b/tests/general/fixtures/project-type003.xml index d44b6c191..8fadfac7a 100644 --- a/tests/general/fixtures/project-type003.xml +++ b/tests/general/fixtures/project-type003.xml @@ -1,5 +1,6 @@ + false false