Exemplo n.º 1
0
def test_get_breeds_failure(bot, responses):
    responses.add(responses.GET, LIST_BREEDS_URI, json=build_breeds(success=False))
    clazz = DogPhotos(bot)
    with pytest.raises(RuntimeError):
        clazz.get_breeds()
    assert len(responses.calls) == 1
    assert responses.calls[0].request.url == LIST_BREEDS_URI
Exemplo n.º 2
0
def test_get_breeds_success(bot, responses):
    responses.add(responses.GET, LIST_BREEDS_URI, json=build_breeds(success=True))
    clazz = DogPhotos(bot)
    response = clazz.get_breeds()
    assert response == ["collie", "border collie", "dog"]
    assert len(responses.calls) == 1
    assert responses.calls[0].request.url == LIST_BREEDS_URI