def test_cmd_dublin_bike(bot, update): with patch.object(update.message, "reply_text") as m: dublin_bike.cmd_dublin_bike(bot, update, args=["89"]) m.assert_called_with("Dublin bike station 89:\n" " Bikes 4\n" " Free spaces 36\n" " Location FITZWILLIAM SQUARE EAST\n")
def test_cmd_dublin_bike_on_error(urlopen_mock, update, context): urlopen_mock.site_effect = ValueError() with patch.object(update.message, "reply_text") as m: context.args = ["200"] dublin_bike.cmd_dublin_bike(update, context) m.assert_called_with("Oops deu merda!")
def test_cmd_dublin_bike_without_bike_stop(update, context): with patch.object(update.message, "reply_text") as m: context.args = [] dublin_bike.cmd_dublin_bike(update, context) m.assert_called_with("Use: /bike <bike station number>")