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 6003513 commit 21f8b99Copy full SHA for 21f8b99
stock_alerter/tests/test_alert.py
@@ -22,3 +22,15 @@ def test_action_is_executed_when_rule_matches(self):
22
alert.connect(exchange)
23
exchange["GOOG"].update(datetime(2014, 2, 10), 11)
24
action.execute.assert_called_with("sample alert")
25
+
26
+ def test_action_doesnt_fire_if_rule_doesnt_match(self):
27
+ goog = Stock("GOOG")
28
+ exchange = {"GOOG": goog}
29
+ rule = PriceRule("GOOG", lambda stock: stock.price > 10)
30
+ rule_spy = mock.MagicMock(wraps=rule)
31
+ action = mock.MagicMock()
32
+ alert = Alert("sample alert", rule_spy, action)
33
+ alert.connect(exchange)
34
+ alert.check_rule(goog)
35
+ rule_spy.matches.assert_called_with(exchange)
36
+ self.assertFalse(action.execute.called)
0 commit comments