class TestRoleRelativePath(unittest.TestCase):
    collection = RulesCollection()
    collection.register(RoleRelativePath())

    def setUp(self):
        self.runner = RunFromText(self.collection)

    @pytest.mark.xfail(
        Version(get_dist_version('ansible')) >= Version('2.10.dev0')
        and Version(get_dist_version('ansible-base')) >= Version('2.10.dev0'),
        reason='Post-split Ansible Core Engine does not have '
        'the module used in the test playbook.'
        ' Ref: https://github.com/ansible/ansible-lint/issues/703.'
        ' Ref: https://github.com/ansible/ansible/pull/68598.',
        raises=SystemExit,
        strict=True,
    )
    def test_fail(self):
        results = self.runner.run_role_tasks_main(FAIL_TASKS)
        self.assertEqual(4, len(results))

    @pytest.mark.xfail(
        Version(get_dist_version('ansible')) >= Version('2.10.dev0')
        and Version(get_dist_version('ansible-base')) >= Version('2.10.dev0'),
        reason='Post-split Ansible Core Engine does not have '
        'the module used in the test playbook.'
        ' Ref: https://github.com/ansible/ansible-lint/issues/703.'
        ' Ref: https://github.com/ansible/ansible/pull/68598.',
        raises=SystemExit,
        strict=True,
    )
    def test_success(self):
        results = self.runner.run_role_tasks_main(SUCCESS_TASKS)
        self.assertEqual(0, len(results))
예제 #2
0
class TestRoleRelativePath(unittest.TestCase):
    collection = RulesCollection()
    collection.register(RoleRelativePath())

    def setUp(self):
        self.runner = RunFromText(self.collection)

    def test_role_relative_path(self):
        results = self.runner.run_role_tasks_main(ROLE_RELATIVE_PATH)
        self.assertEqual(4, len(results))
예제 #3
0
class TestRoleRelativePath(unittest.TestCase):
    collection = RulesCollection()
    collection.register(RoleRelativePath())

    def setUp(self):
        self.runner = RunFromText(self.collection)

    def test_fail(self):
        results = self.runner.run_role_tasks_main(FAIL_TASKS)
        self.assertEqual(4, len(results))

    def test_success(self):
        results = self.runner.run_role_tasks_main(SUCCESS_TASKS)
        self.assertEqual(0, len(results))