def test_cancel_suppressions(): scheduler.schedule_suppression("good_job", T(5), T(15)) scheduler.schedule_suppression("odd_job", T(10), T(20)) scheduler.schedule_suppression("good_job", T(20), T(30)) scheduler.cancel_suppressions("good_job") ss = scheduler.get_suppressions() assert len(ss) == 1 assert_suppression_matches(ss[0], "odd_job", T(10), T(20))
def test_schedule_suppression(): scheduler.schedule_suppression("good_job", T(5), T(15)) scheduler.schedule_suppression("odd_job", T(10), T(20)) scheduler.schedule_suppression("good_job", T(20), T(30)) ss = scheduler.get_suppressions() assert len(ss) == 3 assert_suppression_matches(ss[0], "good_job", T(5), T(15)) assert_suppression_matches(ss[1], "odd_job", T(10), T(20)) assert_suppression_matches(ss[2], "good_job", T(20), T(30))
def test_schedule_suppression_with_start_at_after_end_at(): with assert_slack_client_sends_messages( websocket=[("channel", "[start_at] and [end_at]")]): handle_message("test suppress job from 11:30 to 11:20") with assert_slack_client_sends_messages( websocket=[("channel", "[start_at] and [end_at]")]): handle_message("test suppress job from 11:20 to 11:20") assert not scheduler.get_suppressions()
def test_remove_expired_suppressions(freezer): scheduler.schedule_suppression("good_job", T(5), T(15)) scheduler.schedule_suppression("odd_job", T(10), T(20)) scheduler.schedule_suppression("good_job", T(20), T(30)) freezer.move_to(T(17)) scheduler.remove_expired_suppressions() ss = scheduler.get_suppressions() assert len(ss) == 2 assert_suppression_matches(ss[0], "odd_job", T(10), T(20)) assert_suppression_matches(ss[1], "good_job", T(20), T(30))
def test_schedule_suppression(): handle_message("test suppress job from 11:20 to 11:30") ss = scheduler.get_suppressions() assert len(ss) == 1 assert_suppression_matches(ss[0], "test_good_job", T(467), T(1067))
def test_cancel_suppression(): handle_message("test suppress job from 11:20 to 11:30") assert scheduler.get_suppressions() handle_message("test cancel suppression") assert not scheduler.get_suppressions()