Exemple #1
0
 def test_when_rule_failed(self, capsys, settings):
     rule = Rule('test', Mock(side_effect=OSError('Denied')),
                 requires_output=False)
     assert not corrector.is_rule_match(
         Command('ls'), rule, settings)
     assert capsys.readouterr()[1].split('\n')[0] == '[WARN] Rule test:'
Exemple #2
0
 def test_match(self, settings):
     rule = Rule('', lambda x, _: x.script == 'cd ..')
     assert corrector.is_rule_match(Command('cd ..'), rule, settings)
Exemple #3
0
 def test_no_match(self, settings):
     assert not corrector.is_rule_match(
         Command('ls'), Rule('', lambda *_: False), settings)
Exemple #4
0
 def test_when_rule_failed(self, capsys, settings):
     rule = Rule('test',
                 Mock(side_effect=OSError('Denied')),
                 requires_output=False)
     assert not corrector.is_rule_match(Command('ls'), rule, settings)
     assert capsys.readouterr()[1].split('\n')[0] == '[WARN] Rule test:'
Exemple #5
0
 def test_match(self, settings):
     rule = Rule('', lambda x, _: x.script == 'cd ..')
     assert corrector.is_rule_match(Command('cd ..'), rule, settings)
Exemple #6
0
 def test_no_match(self, settings):
     assert not corrector.is_rule_match(
         Command('ls'), Rule('', lambda *_: False), settings)