def test_fs():
    api_url = os.environ['DCACHE_API_URL']
    webdav_url = os.environ['DCACHE_WEBDAV_URL']
    token = os.environ['DCACHE_TOKEN']
    _setup_test_dir(webdav_url, token)
    return dCacheFileSystem(api_url=api_url,
                            token=token,
                            webdav_url=webdav_url)
def test_initialize_fs_without_webdav_url():
    fs = dCacheFileSystem(token='test_token')
    with pytest.raises(ValueError):
        fs.get('/test/test.txt', 'test.txt')
def test_initialize_fs_without_api_url():
    fs = dCacheFileSystem(token='test_token')
    with pytest.raises(ValueError):
        fs.ls('/test')
def test_initialize_fs_with_both_auth_and_token():
    with pytest.raises(ValueError):
        _ = dCacheFileSystem(username='******',
                             password='******',
                             token='test_token')
def test_initialize_fs_without_password():
    with pytest.raises(ValueError):
        _ = dCacheFileSystem(username='******', )