def test_basic(self):
     filename = os.path.join(fixtures_path, 'combination-filter.xml')
     root = get_xml_root(filename=filename)
     jobname = "test"
     yml = root_to_yaml(root, jobname)
     dct = yaml.safe_load(yml)
     assert len(dct) == 1
     assert dct[0]['job']['execution-strategy'][
         'combination-filter'] == "(lorem == ipsum)"
Ejemplo n.º 2
0
    def compare_jjb_output(self, name, job_name):
        test_filename = os.path.join(fixtures_path, name + '.xml')
        expected_yml_filename = os.path.join(fixtures_path, name + '.yml')
        root = get_xml_root(filename=test_filename)
        actual_yml = root_to_yaml(root, job_name)

        with open(expected_yml_filename) as f:
            expected_yml = f.read()

        assert actual_yml is not None
        assert actual_yml == expected_yml
Ejemplo n.º 3
0
 def run_jjw(self, name):
     xml_filename = os.path.join(fixtures_path, name + '.xml')
     root = get_xml_root(filename=xml_filename)
     yaml = root_to_yaml(root, name)
     actual_yaml_filename = os.path.join(fixtures_path, name + '.yaml.actual')
     with open(actual_yaml_filename, "w") as f:
         f.write(yaml)
     expected_yaml_filename = os.path.join(fixtures_path, name + '.yaml')
     with open(expected_yaml_filename) as f:
         expected_yaml = f.read()
     assert expected_yaml == yaml
Ejemplo n.º 4
0
    def run_jjb(self, name):
        filename = os.path.join(fixtures_path, name + '.xml')
        root = get_xml_root(filename=filename)
        yaml = root_to_yaml(root, name)

        # Run this wrecker YAML thru JJB.
        # XXX: shelling out with call() sucks; use JJB's API instead
        temp = tempfile.NamedTemporaryFile()
        temp.write(yaml)
        temp.flush()
        assert call(["jenkins-jobs", 'test', temp.name]) == 0
        temp.close()
    def run_jjb(self, name):
        filename = os.path.join(fixtures_path, name + '.xml')
        root = get_xml_root(filename=filename)
        yaml = root_to_yaml(root, name)

        # Run this wrecker YAML thru JJB.
	# XXX: shelling out with call() sucks; use JJB's API instead
        temp = tempfile.NamedTemporaryFile()
        temp.write(yaml)
        temp.flush()
        assert call(["jenkins-jobs", 'test', temp.name]) == 0
        temp.close()
Ejemplo n.º 6
0
    def test_gerrit_trigger_comparison(self):
        test_filename = os.path.join(fixtures_path, 'gerrit_trigger.xml')
        expected_yml_filename = os.path.join(fixtures_path,
                                             'gerrit_trigger.yml')
        root = get_xml_root(filename=test_filename)
        actual_yml = root_to_yaml(root, "gerrit-trigger")

        with open(expected_yml_filename) as f:
            expected_yml = f.read()

        assert actual_yml is not None
        assert actual_yml == expected_yml
Ejemplo n.º 7
0
    def run_jjb(self, name, jobname=None):
        filename = os.path.join(fixtures_path, name + '.xml')
        root = get_xml_root(filename=filename)
        if jobname is None:
            jobname = name
        yaml = root_to_yaml(root, jobname)

        # Run this wrecker YAML thru JJB.
        temp = tempfile.NamedTemporaryFile()
        temp.write(yaml)
        temp.flush()
        assert jenkins_jobs.cmd.main(['test', temp.name]) is None
        temp.close()
Ejemplo n.º 8
0
    def run_jjb(self, name, jobname=None):
        filename = os.path.join(fixtures_path, name + '.xml')
        root = get_xml_root(filename=filename)
        if jobname is None:
            jobname = name
        yaml = root_to_yaml(root, jobname)

        # Run this wrecker YAML thru JJB.
        with tempfile.NamedTemporaryFile('w') as temp:
            temp.write(yaml)
            temp.flush()
            jjb = JenkinsJobs(['test', temp.name])
            assert jjb.execute() is None