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) )
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')
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')
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()
class TestCaseModuleSCMMacro(base.SingleJobTestCase): fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures") scenarios = base.get_scenarios(fixtures_path)
class TestCaseModulePublishers(TestWithScenarios, TestCase, BaseTestCase): fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures') scenarios = get_scenarios(fixtures_path) klass = views.Views
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
class TestCaseModuleWrappers(TestWithScenarios, BaseTestCase, TestCase): fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures') scenarios = get_scenarios(fixtures_path) klass = wrappers.Wrappers
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")
class TestCaseModuleWrappers(base.BaseScenariosTestCase): fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures") scenarios = base.get_scenarios(fixtures_path) klass = wrappers.Wrappers
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
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
class TestCaseModuleViewList(base.BaseScenariosTestCase): fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures') scenarios = base.get_scenarios(fixtures_path) klass = view_list.List
class TestCaseModuleSCM(TestWithScenarios, TestCase, BaseTestCase): fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures') scenarios = get_scenarios(fixtures_path) klass = scm.SCM
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
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')
class TestCaseModuleViewPipeline(base.BaseScenariosTestCase): fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures") scenarios = base.get_scenarios(fixtures_path) klass = view_pipeline.Pipeline
class TestCaseModuleNotifications(TestWithScenarios, BaseTestCase, TestCase): fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures') scenarios = get_scenarios(fixtures_path) klass = notifications.Notifications
class TestCaseModulePublishers(TestWithScenarios, BaseTestCase, TestCase): fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures') scenarios = get_scenarios(fixtures_path) klass = hipchat_notif.HipChat
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
class TestCaseModuleNotifications(base.BaseScenariosTestCase): fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures") scenarios = base.get_scenarios(fixtures_path) klass = notifications.Notifications
class TestCaseModuleViewSectioned(base.BaseScenariosTestCase): fixtures_path = os.path.join(os.path.dirname(__file__), "fixtures") scenarios = base.get_scenarios(fixtures_path) klass = view_sectioned.Sectioned
class TestCaseModuleReporters(TestWithScenarios, TestCase, BaseTestCase): fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures') scenarios = get_scenarios(fixtures_path) klass = reporters.Reporters
class TestCaseModuleSCMMacro(TestWithScenarios, SingleJobTestCase, TestCase): fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures') scenarios = get_scenarios(fixtures_path)