Exemplo n.º 1
0
def test_move_folder_to_dir():
    f = Folder({})
    f._move_url = 'http://move.me/uri'
    f._post = MagicMock(return_value=FakeResponse(201, {'data': {}}))

    folder = Folder({})
    folder.path = 'sample/'

    f.move_to('osfclient', folder)

    f._post.assert_called_once_with('http://move.me/uri',
                                    json={'action': 'move', 'path': 'sample/'})
Exemplo n.º 2
0
def test_move_folder_failed():
    f = Folder({})
    f.path = 'some/path'
    f._move_url = 'http://move.me/uri'
    # TODO
    f._post = MagicMock(return_value=FakeResponse(204, {'data': {}}))

    folder = Folder({})
    folder.path = 'sample/'

    with pytest.raises(RuntimeError) as e:
        f.move_to('osfclient', folder)

    assert f._post.called

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