示例#1
0
class TestCaseValidateScenarios(TestWithScenarios, TestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), "../fixtures/cmd/validate")
    scenarios = get_scenarios(fixtures_path)

    def test_command(self):
        if os.path.basename(self.in_filename).startswith("good-"):
            self._validate_success()
        else:
            self._validate_failure()

    def _validate_failure(self):
        required = [
            "%s: ERROR:" % self.in_filename,
        ]
        stdout, stderr = self.shell("validate %s" % self.in_filename, exitcodes=[1])
        for r in required:
            self.assertThat(
                (stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE)
            )

    def _validate_success(self):
        required = [
            "SUCCESS!",
        ]
        stdout, stderr = self.shell("validate %s" % self.in_filename, exitcodes=[0])
        for r in required:
            self.assertThat(
                (stdout + stderr), matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE)
            )
示例#2
0
class TestCaseModuleYamlInclude(TestWithScenarios, TestCase, BaseTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path)

    def test_yaml_snippet(self):
        if not self.xml_filename or not self.yaml_filename:
            return

        xml_filepath = os.path.join(self.fixtures_path, self.xml_filename)
        expected_xml = u"%s" % open(xml_filepath, 'r').read()

        yaml_filepath = os.path.join(self.fixtures_path, self.yaml_filename)

        parser = YamlParser()
        parser.parse(yaml_filepath)

        # Generate the XML tree
        parser.generateXML()

        # Prettify generated XML
        pretty_xml = parser.jobs[0].output()

        self.assertThat(
            pretty_xml,
            testtools.matchers.DocTestMatches(
                expected_xml, doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE
                | doctest.REPORT_NDIFF))
class TestCaseLocalYamlAnchorAlias(TestWithScenarios, YamlTestCase, TestCase):
    """
    Verify yaml input is expanded to the expected yaml output when using yaml
    anchors and aliases.
    """
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path, 'iyaml', 'oyaml')
示例#4
0
class TestCaseLocalYamlInclude(TestWithScenarios, TestCase, JsonTestCase):
    """
    Verify application specific tags independently of any changes to
    modules XML parsing behaviour
    """
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path, 'yaml', 'json')
示例#5
0
class TestCaseLocalYamlAnchorAlias(base.YamlTestCase):
    """
    Verify yaml input is expanded to the expected yaml output when using yaml
    anchors and aliases.
    """

    fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures")
    scenarios = base.get_scenarios(fixtures_path, "iyaml", "oyaml")
class TestCaseModuleDuplicates(TestWithScenarios, SingleJobTestCase, TestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path)

    @mock.patch('jenkins_jobs.builder.logger', autospec=True)
    def test_yaml_snippet(self, mock_logger):

        if os.path.basename(self.in_filename).startswith("exception_"):
            with ExpectedException(JenkinsJobsException, "^Duplicate .*"):
                super(TestCaseModuleDuplicates, self).test_yaml_snippet()
        else:
            super(TestCaseModuleDuplicates, self).test_yaml_snippet()
class TestCaseLocalYamlInclude(TestWithScenarios, JsonTestCase, TestCase):
    """
    Verify application specific tags independently of any changes to
    modules XML parsing behaviour
    """
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path, 'yaml', 'json',
                              filter_func=_exclude_scenarios)

    def test_yaml_snippet(self):

        if os.path.basename(self.in_filename).startswith("exception_"):
            with ExpectedException(ComposerError,
                                   "^found duplicate anchor .*"):
                super(TestCaseLocalYamlInclude, self).test_yaml_snippet()
        else:
            super(TestCaseLocalYamlInclude, self).test_yaml_snippet()
示例#8
0
class TestCaseModuleSCMMacro(base.SingleJobTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures")
    scenarios = base.get_scenarios(fixtures_path)
示例#9
0
class TestCaseModulePublishers(TestWithScenarios, TestCase, BaseTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path)
    klass = views.Views
示例#10
0
class TestCaseSchema(TestWithScenarios, TestCase, BaseTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path)
class TestCaseModuleProperties(base.BaseScenariosTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = base.get_scenarios(fixtures_path)
    klass = properties.Properties
示例#12
0
class TestCaseModuleWrappers(TestWithScenarios, BaseTestCase, TestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path)
    klass = wrappers.Wrappers
示例#13
0
class TestCaseModuleJsonParser(base.SingleJobTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures")
    scenarios = base.get_scenarios(fixtures_path, in_ext="json", out_ext="xml")
示例#14
0
class TestCaseModuleWrappers(base.BaseScenariosTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures")
    scenarios = base.get_scenarios(fixtures_path)
    klass = wrappers.Wrappers
示例#15
0
class TestCaseGithubOrganization(base.BaseScenariosTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures")
    scenarios = base.get_scenarios(fixtures_path)
    default_config_file = "/dev/null"
    klass = project_githuborg.GithubOrganization
示例#16
0
class TestCaseModuleYamlInclude(base.SingleJobTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = base.get_scenarios(fixtures_path)
class TestCaseModuleProperties(TestWithScenarios, BaseTestCase, TestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path)
    klass = properties.Properties
示例#18
0
class TestCaseModuleViewList(base.BaseScenariosTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = base.get_scenarios(fixtures_path)
    klass = view_list.List
示例#19
0
class TestCaseModuleSCM(TestWithScenarios, TestCase, BaseTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path)
    klass = scm.SCM
示例#20
0
class TestCaseModuleGeneral(TestWithScenarios, BaseTestCase, TestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path)
    klass = general.General
class TestCaseModuleTriggers(base.BaseScenariosTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = base.get_scenarios(fixtures_path)
    klass = triggers.Triggers
示例#22
0
class TestCaseModuleJsonParser(TestWithScenarios,
                               SingleJobTestCase, TestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path, in_ext='json', out_ext='xml')
示例#23
0
class TestCaseModuleViewPipeline(base.BaseScenariosTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures")
    scenarios = base.get_scenarios(fixtures_path)
    klass = view_pipeline.Pipeline
示例#24
0
class TestCaseModuleNotifications(TestWithScenarios, BaseTestCase, TestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path)
    klass = notifications.Notifications
示例#25
0
class TestCaseModulePublishers(TestWithScenarios, BaseTestCase, TestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path)
    klass = hipchat_notif.HipChat
示例#26
0
class TestCaseMultibranchPipeline(base.BaseScenariosTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures")
    scenarios = base.get_scenarios(fixtures_path)
    default_config_file = "/dev/null"
    klass = project_multibranch.WorkflowMultiBranch
示例#27
0
class TestCaseModuleNotifications(base.BaseScenariosTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures")
    scenarios = base.get_scenarios(fixtures_path)
    klass = notifications.Notifications
示例#28
0
class TestCaseModuleViewSectioned(base.BaseScenariosTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures")
    scenarios = base.get_scenarios(fixtures_path)
    klass = view_sectioned.Sectioned
示例#29
0
class TestCaseModuleReporters(TestWithScenarios, TestCase, BaseTestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path)
    klass = reporters.Reporters
示例#30
0
class TestCaseModuleSCMMacro(TestWithScenarios, SingleJobTestCase, TestCase):
    fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures')
    scenarios = get_scenarios(fixtures_path)