class TestSudoRuleWithFile(unittest.TestCase): file1 = 'test/sudo.yml' def setUp(self): self.rule = SudoRule() def test_matchplay_sudo(self): yaml = ansiblelint.utils.parse_yaml_linenumbers(open(self.file1).read()) self.assertTrue(yaml) for play in yaml: result = self.rule.matchplay(self.file1, play) self.assertEquals(2, len(result))
class TestSudoRuleWithFile(unittest.TestCase): file1 = 'test/sudo.yml' def setUp(self): self.rule = SudoRule() def test_matchplay_sudo(self): yaml = ansiblelint.utils.parse_yaml_linenumbers( open(self.file1).read()) self.assertTrue(yaml) for play in yaml: result = self.rule.matchplay(self.file1, play) self.assertEquals(2, len(result))
class TestSudoRuleWithFile(unittest.TestCase): file1 = 'test/sudo.yml' def setUp(self): self.rule = SudoRule() def test_matchplay_sudo(self): yaml = ansiblelint.utils.parse_yaml_linenumbers(open(self.file1).read(), self.file1) self.assertTrue(yaml) for play in yaml: result = self.rule.matchplay(self.file1, play) self.assertEquals(2, len(result)) def test_matchtask_sudo(self): yaml = ansiblelint.utils.parse_yaml_linenumbers(open(self.file1).read(), self.file1) results = [] for task in ansiblelint.utils.get_normalized_tasks(yaml, dict(path=self.file1, type='playbook')): results.append(self.rule.matchtask(self.file1, task)) self.assertEquals(1, len([result for result in results if result]))
class TestSudoRuleWithFile(unittest.TestCase): file1 = 'test/sudo.yml' def setUp(self): self.rule = SudoRule() def test_matchplay_sudo(self): yaml = ansiblelint.utils.parse_yaml_linenumbers( open(self.file1).read(), self.file1) self.assertTrue(yaml) for play in yaml: result = self.rule.matchplay(self.file1, play) self.assertEquals(2, len(result)) def test_matchtask_sudo(self): yaml = ansiblelint.utils.parse_yaml_linenumbers( open(self.file1).read(), self.file1) results = [] for task in ansiblelint.utils.get_normalized_tasks( yaml, dict(path=self.file1, type='playbook')): results.append(self.rule.matchtask(self.file1, task)) self.assertEquals(1, len([result for result in results if result]))