Skip to content

Commit

Permalink
Added a test for rule scheduler removal
Browse files Browse the repository at this point in the history
  • Loading branch information
Qmando committed Sep 23, 2019
1 parent db10b2c commit 3c0aa03
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 1049,15 @@ def test_rule_changes(ea):
ea.load_rule_changes()
assert len(ea.rules) == 4

# Disable a rule by removing the file
new_hashes.pop('rules/rule4.yaml')
with mock.patch.object(ea.conf['rules_loader'], 'get_hashes') as mock_hashes:
with mock.patch.object(ea.conf['rules_loader'], 'load_configuration') as mock_load:
mock_load.return_value = {'filter': [], 'name': 'rule4', 'new': 'stuff', 'rule_file': 'rules/rule4.yaml'}
mock_hashes.return_value = new_hashes
ea.load_rule_changes()
ea.scheduler.remove_job.assert_called_with(job_id='rule4')


def test_strf_index(ea):
""" Test that the get_index function properly generates indexes spanning days """
Expand Down

0 comments on commit 3c0aa03

Please sign in to comment.