

def test_text_response():

    class HTTPError(Exception):
        pass
    response = Mock()
    response.text = 'OK'
    response.raise_for_status.side_effect = [None, HTTPError()]
    mock = Mock()
    mock.url = 'http://example.com'
    mock.http_client.request.return_value = response
    text = TextResponseProperty(method='POST')
    rv = rv.provide_value(mock)
    assert (rv == 'OK')
    response.raise_for_status.assert_called_once_with()
    mock.http_client.request.assert_called_once_with(method='POST', url='http://example.com')
    with raises(HTTPError):
        text.provide_value(mock)

dataset/ETHPy150Open douban/brownant/tests/test_pipeline/test_network.py test_text_response/VarMisuse@80/103 `text`->`rv`