Exemplo n.º 1
0
def test_shio_argument(mocker):
    prompt_txt = 'Please input the date in yyyy-mm-dd format, e.g. 1998-05-02'
    mocked_reply_to = mocker.patch('csuibot.handlers.bot.reply_to')
    mock_message = Mock(text='/shio')
    shio(mock_message)

    args, _ = mocked_reply_to.call_args
    assert args[1] == prompt_txt
Exemplo n.º 2
0
def test_shio_argument(mocker):
    prompt_txt = 'Please input the date in yyyy-mm-dd format, e.g. 1998-05-02'
    mocked_reply_to = mocker.patch('csuibot.handlers.bot.reply_to')
    mock_message = Mock(text='/shio')
    shio(mock_message)

    args, _ = mocked_reply_to.call_args
    assert args[1] == prompt_txt
Exemplo n.º 3
0
def test_shio(mocker):
    fake_shio = 'foo bar'
    mocked_reply_to = mocker.patch('csuibot.handlers.bot.reply_to')
    mocker.patch('csuibot.handlers.lookup_chinese_zodiac', return_value=fake_shio)
    mock_message = Mock(text='/shio 2015-05-05')
    shio(mock_message)

    args, _ = mocked_reply_to.call_args
    assert args[1] == fake_shio
Exemplo n.º 4
0
def test_shio(mocker):
    fake_shio = 'foo bar'
    mocked_reply_to = mocker.patch('csuibot.handlers.bot.reply_to')
    mocker.patch('csuibot.handlers.lookup_chinese_zodiac',
                 return_value=fake_shio)
    mock_message = Mock(text='/shio 2015-05-05')
    shio(mock_message)

    args, _ = mocked_reply_to.call_args
    assert args[1] == fake_shio
Exemplo n.º 5
0
def test_shio_invalid_year(mocker):
    mocked_reply_to = mocker.patch('csuibot.handlers.bot.reply_to')
    mocker.patch('csuibot.handlers.lookup_chinese_zodiac',
                 side_effect=ValueError)
    mock_message = Mock(text='/shio 1134-05-05')

    shio(mock_message)

    args, _ = mocked_reply_to.call_args
    assert args[1] == 'Year is invalid'