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://"} fs = AzureFileSystem(dvc, config) assert fs.path_info == "azure://" + container_name
def test_init(dvc): prefix = "some/prefix" url = f"azure://{container_name}/{prefix}" config = {"url": url, "connection_string": connection_string} fs = AzureFileSystem(dvc, config) assert fs.path_info == url assert fs._conn_str == connection_string
def test_info(tmp_dir, azure): tmp_dir.gen("foo", "foo") fs = AzureFileSystem(None, azure.config) to_info = azure fs.upload(PathInfo("foo"), to_info) assert fs.exists(to_info) hash_ = fs.info(to_info)["etag"] assert isinstance(hash_, str) assert hash_.strip("'").strip('"') == hash_
def get_login_method(config): fs = AzureFileSystem(**config) # pylint: disable=pointless-statement return fs.login_method
def test_init(dvc): config = {"connection_string": connection_string} fs = AzureFileSystem(**config) assert fs.fs_args["connection_string"] == connection_string
def test_strip_protocol(dvc): assert (AzureFileSystem._strip_protocol(f"azure://{container_name}") == f"azure://{container_name}")
def test_strip_protocol_env_var(monkeypatch, dvc): monkeypatch.setenv("AZURE_STORAGE_CONTAINER_NAME", container_name) monkeypatch.setenv("AZURE_STORAGE_CONNECTION_STRING", connection_string) assert (AzureFileSystem._strip_protocol("azure://") == f"azure://{container_name}")