Files
dvc/tests/unit/remote/test_webdav.py
T
Saugat Pachhai 72eb4a5737 Add test server and tests for webdav (#4827)
* Add test server and tests for webdav

* Fix webdav unittests
2020-11-12 13:52:46 +05:45

46 lines
1.0 KiB
Python

import pytest
from dvc.tree.webdav import WebDAVTree
# Test configuration
url = "webdavs://example.com/public.php/webdav"
user = "username"
userurl = f"webdavs://{user}@example.com/public.php/webdav"
password = "password"
# Test minimum requiered configuration (url)
def test_init(dvc):
config = {"url": url}
tree = WebDAVTree(dvc, config)
assert tree.path_info == url
# Test username from configuration
@pytest.mark.parametrize(
"config", [{"url": url, "user": user}, {"url": userurl}]
)
def test_user(dvc, config):
tree = WebDAVTree(dvc, config)
assert tree.user == user
# Test username extraction from url
def test_userurl(dvc):
config = {"url": userurl}
tree = WebDAVTree(dvc, config)
assert tree.path_info == userurl
assert tree.user == user
assert tree.path_info.user == user
# test password from config
def test_password(dvc):
config = {"url": url, "user": user, "password": password}
tree = WebDAVTree(dvc, config)
assert tree.password == password