Exemplo n.º 1
0
 def test_isnt_match_when_rule_failed(self, capsys):
     rule = Rule('test',
                 Mock(side_effect=OSError('Denied')),
                 requires_output=False)
     assert not rule.is_match(Command('ls'))
     assert capsys.readouterr()[1].split('\n')[0] == '[WARN] Rule test:'
Exemplo n.º 2
0
 def test_isnt_match_when_rule_failed(self, capsys):
     rule = Rule('test', Mock(side_effect=OSError('Denied')),
                 requires_output=False)
     assert not rule.is_match(Command('ls'))
     assert capsys.readouterr()[1].split('\n')[0] == '[WARN] Rule test:'
Exemplo n.º 3
0
 def test_is_match(self):
     rule = Rule('', lambda x: x.script == 'cd ..')
     assert rule.is_match(Command('cd ..'))
Exemplo n.º 4
0
 def test_is_match(self):
     rule = Rule('', lambda x: x.script == 'cd ..')
     assert rule.is_match(Command('cd ..'))
Exemplo n.º 5
0
 def test_isnt_match_when_rule_failed(self, capsys):
     rule = Rule("test",
                 Mock(side_effect=OSError("Denied")),
                 requires_output=False)
     assert not rule.is_match(Command("ls", ""))
     assert capsys.readouterr()[1].split("\n")[0] == "[WARN] Rule test:"
Exemplo n.º 6
0
 def test_is_match(self):
     rule = Rule("", lambda x: x.script == "cd ..")
     assert rule.is_match(Command("cd ..", ""))
Exemplo n.º 7
0
 def test_isnt_match_when_rule_failed(self, capsys):
     rule = Rule("test", Mock(side_effect=OSError("Denied")), requires_output=False)
     assert not rule.is_match(Command("ls"))
     assert capsys.readouterr()[1].split("\n")[0] == "[WARN] Rule test:"
Exemplo n.º 8
0
 def test_is_match(self):
     rule = Rule("", lambda x: x.script == "cd ..")
     assert rule.is_match(Command("cd .."))