コード例 #1
0
ファイル: test_file.py プロジェクト: RCOSDP/rdmclient
def test_remove_file():
    f = File({})
    f._delete_url = 'http://delete.me/uri'
    f._delete = MagicMock(return_value=FakeResponse(204, {'data': {}}))

    f.remove()

    assert f._delete.called
コード例 #2
0
ファイル: test_file.py プロジェクト: RCOSDP/rdmclient
def test_remove_file_failed():
    f = File({})
    f.path = 'some/path'
    f._delete_url = 'http://delete.me/uri'
    f._delete = MagicMock(return_value=FakeResponse(404, {'data': {}}))

    with pytest.raises(RuntimeError) as e:
        f.remove()

    assert f._delete.called

    assert 'Could not delete' in e.value.args[0]