Exemple #1
0
def test_sshfs_mount_failed(mocker):
    mock_ls = mocker.patch.object(os, 'listdir')
    mock_rmdir = mocker.patch('os.rmdir', side_effect=lambda x: True)
    mock_system = mocker.patch('os.system', side_effect=lambda x: 1)
    mock_mkdir = mocker.patch('os.mkdir', side_effect=lambda x: True)
    mock_exists = mocker.patch('os.path.exists', side_effect=lambda x: False)

    mock_ls.return_value = [
        '/home/dummy/.bridgy/mounts/baddir',
        '/home/dummy/.bridgy/mounts/awesomebox@devbox'
    ]
    config = Config({})
    sshObj = Sshfs(config, instance, remotedir='/tmp/test')
    sshObj.mount()
    assert mock_exists.called
    assert mock_mkdir.called
    assert mock_system.called
    assert mock_rmdir.called
Exemple #2
0
def test_sshfs_mount_remotedir_missing():
    config = Config({})
    sshObj = Sshfs(config, instance)
    with pytest.raises(BadRemoteDir):
        sshObj.mount()