示例#1
0
def test_init(dvc):
    prefix = "some/prefix"
    url = f"azure://{container_name}/{prefix}"
    config = {"url": url, "connection_string": connection_string}
    tree = AzureTree(dvc, config)
    assert tree.path_info == url
    assert tree._conn_str == connection_string
示例#2
0
def test_init_env_var(monkeypatch, dvc):
    monkeypatch.setenv("AZURE_STORAGE_CONTAINER_NAME", container_name)
    monkeypatch.setenv("AZURE_STORAGE_CONNECTION_STRING", connection_string)

    config = {"url": "azure://"}
    tree = AzureTree(dvc, config)
    assert tree.path_info == "azure://" + container_name
    assert tree._conn_str == connection_string
示例#3
0
def test_get_file_hash(tmp_dir, azure):
    tmp_dir.gen("foo", "foo")

    tree = AzureTree(None, azure.config)
    to_info = azure
    tree.upload(PathInfo("foo"), to_info)
    assert tree.exists(to_info)
    hash_ = tree.get_file_hash(to_info)
    assert hash_
    assert isinstance(hash_, str)
    assert hash_.strip("'").strip('"') == hash_