We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 21f8b99 commit 5d10c46Copy full SHA for 5d10c46
stock_alerter/tests/test_alert.py
@@ -34,3 +34,18 @@ def test_action_doesnt_fire_if_rule_doesnt_match(self):
34
alert.check_rule(goog)
35
rule_spy.matches.assert_called_with(exchange)
36
self.assertFalse(action.execute.called)
37
+
38
+ def test_action_fires_when_rule_matches(self):
39
+ goog = Stock("GOOG")
40
+ exchange = {"GOOG": goog}
41
+ main_mock = mock.MagicMock()
42
+ rule = main_mock.rule
43
+ rule.matches.return_value = True
44
+ rule.depends_on.return_value = {"GOOG"}
45
+ action = main_mock.action
46
+ alert = Alert("sample alert", rule, action)
47
+ alert.connect(exchange)
48
+ goog.update(datetime(2014, 5, 14), 11)
49
+ main_mock.assert_has_calls(
50
+ [mock.call.rule.matches(exchange),
51
+ mock.call.action.execute("sample alert")])
0 commit comments