Пример #1
0
    def test_notify_set_lineup(self):
        mock_client = MockClient()
        n = Notifier(mock_client)

        team = "Team1"
        ts = [self.t1, self.t2]

        n.notify_set_lineup(team, self.lt1, ts, [ScoringSetting(BaseballStat.H, False, 0.0)])

        msg = team + ": 50.00PA\n10.00H "
        for t in ts:
            msg += "\n" + Notifier.transition_message(t)

        (msg_rec, url_rec) = mock_client.messages[0]

        self.assertEqual(msg, msg_rec)
        self.assertEqual(None, url_rec)
Пример #2
0
    def test_notify_ignore_non_hitting_stat(self):
        mock_client = MockClient()
        n = Notifier(mock_client)

        team = "Name"
        ts = [self.t1, self.t2]

        n.notify_set_lineup(
            team, self.lt1, ts, [ScoringSetting(BaseballStat.WHIP, True, 0.0)]
        )

        expected = team + ": 50.00PA\n"
        for t in ts:
            expected += "\n" + Notifier.transition_message(t)

        (msg_rec, url_rec) = mock_client.messages[0]

        self.assertEqual(expected, msg_rec)
        self.assertEqual(None, url_rec)
Пример #3
0
 def test_transition_message(self):
     self.assertEqual(Notifier.transition_message(self.t1), "Muncy: 1B/3B->BE")
     self.assertEqual(Notifier.transition_message(self.t2), "Merrifield: OF->2B")