Compare commits

...
2 Commits
Author SHA1 Message Date
f342cc7db5 feat(webdav): add bearer_token_command for dynamic token acquisition (#10917)
Co-authored-by: GreenHatHG <[email protected]>
Co-authored-by: skshetry <[email protected]>
2025-12-05 11:07:22 +05:45
pre-commit-ci[bot] 0eb279ea35 [pre-commit.ci] pre-commit autoupdate (#10921)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-12-03 13:17:20 +05:45
4 changed files with 31 additions and 2 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ repos:
- id: sort-simple-yaml
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.14.6'
rev: 'v0.14.7'
hooks:
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]
+1
View File
@@ -151,6 +151,7 @@ WEBDAV_COMMON = {
"password": str,
"ask_password": Bool,
"token": str,
"bearer_token_command": str,
"custom_auth_header": str,
"cert_path": str,
"key_path": str,
+1 -1
View File
@@ -124,7 +124,7 @@ tests = [
"sqlalchemy>=1,<3", # optional dependency for `import-db`
"pandas>=1", # optional dependency for `import-db`
]
webdav = ["dvc-webdav>=3,<4"]
webdav = ["dvc-webdav>=3.0.1,<4"]
webhdfs = ["dvc-webhdfs>=3.1,<4"]
webhdfs_kerberos = ["dvc-webhdfs[kerberos]>=3.1,<4"]
+28
View File
@@ -153,3 +153,31 @@ def test_remote_with_jobs(dvc, base_url, fs_cls):
assert config["user"] == "admin"
assert f"{scheme}://{user}@example.com" in config["host"]
assert cls is fs_cls
def test_bearer_token_command(mocker):
mock_auth_obj = mocker.Mock()
mock_get_auth = mocker.patch(
"dvc_webdav.get_bearer_auth", return_value=mock_auth_obj
)
command = "my-token-cmd.sh"
timeout = 10
# Configuration with potential conflicts
config = {
"url": url,
"token": "static-token-value",
"user": "conflict-user",
"password": "conflict-password",
"bearer_token_command": command,
"timeout": timeout,
}
fs = WebDAVFileSystem(**config)
# the factory function was invoked with the correct arguments from the config.
mock_get_auth.assert_called_once_with(command, timeout)
# the generated auth object is correctly injected into `fs_args`.
assert fs.fs_args["auth"] == mock_auth_obj