コード例 #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))
コード例 #3
0
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
ファイル: test_localyaml.py プロジェクト: ochirkov/jjb-test
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")
コード例 #6
0
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()
コード例 #7
0
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
ファイル: test_macros.py プロジェクト: ochirkov/jjb-test
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)
コード例 #11
0
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
ファイル: test_jsonparser.py プロジェクト: ochirkov/jjb-test
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
ファイル: test_wrappers.py プロジェクト: ochirkov/jjb-test
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)
コード例 #17
0
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
コード例 #21
0
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
ファイル: test_jsonparser.py プロジェクト: andresrrey/jjb
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)