Ejemplo n.º 1
0
def test_gifme_returns_random_gif():
    mock_api.return_value = mock_api
    mock_api.random_gif.return_value = mock_img

    resp = giphy.giphy(None, '#bots', 'me', 'helga gifme foo', 'gifme', ['foo'])
    assert mock_api.random_gif.called
    assert resp == mock_img.media_url
Ejemplo n.º 2
0
def test_gifme_returns_random_gif():
    mock_api.return_value = mock_api
    mock_api.random_gif.return_value = mock_img

    resp = giphy.giphy(None, '#bots', 'me', 'helga gifme foo', 'gifme',
                       ['foo'])
    assert mock_api.random_gif.called
    assert resp == mock_img.media_url
Ejemplo n.º 3
0
def test_gifme_returns_snark():
    mock_api.random_gif.side_effect = GiphyApiException
    mock_api.translate.side_effect = GiphyApiException
    mock_api.search_list.side_effect = GiphyApiException

    formatted = map(lambda x: x.format(nick='me'), giphy.responses)

    assert giphy.giphy(None, '#bots', 'me', 'helga gifme foo', 'gifme', ['foo']) in formatted
Ejemplo n.º 4
0
def test_gifme_returns_searched():
    mock_api.random_gif.side_effect = GiphyApiException
    mock_api.translate.side_effect = GiphyApiException
    mock_api.search_list.return_value = [mock_img]

    resp = giphy.giphy(None, '#bots', 'me', 'helga gifme foo', 'gifme', ['foo'])
    assert mock_api.search_list.called
    assert resp == mock_img.media_url
Ejemplo n.º 5
0
def test_gifme_returns_snark():
    mock_api.random_gif.side_effect = GiphyApiException
    mock_api.translate.side_effect = GiphyApiException
    mock_api.search_list.side_effect = GiphyApiException

    formatted = map(lambda x: x.format(nick='me'), giphy.responses)

    assert giphy.giphy(None, '#bots', 'me', 'helga gifme foo', 'gifme',
                       ['foo']) in formatted
Ejemplo n.º 6
0
def test_gifme_returns_searched():
    mock_api.random_gif.side_effect = GiphyApiException
    mock_api.translate.side_effect = GiphyApiException
    mock_api.search_list.return_value = [mock_img]

    resp = giphy.giphy(None, '#bots', 'me', 'helga gifme foo', 'gifme',
                       ['foo'])
    assert mock_api.search_list.called
    assert resp == mock_img.media_url