mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-06 15:28:28 +01:00
Replaced Path* dataclasses with PathInfo/URLInfo/CloudURLInfo, which know how parse, serialize, stringify and join themselves. They also provide useful accessors like part of an url or pathlib.Path like .parent or .name. Along the way two families of bugs where fixed and should never occur in the future: - paths not matched as strings anymore, e.g. using str.startswith() - Output.path is eliminated as ambiguous Both families might had caused undefined surprising behavior when local and remote paths clash.
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
from unittest import TestCase
|
|
|
|
from dvc.remote.azure import RemoteAZURE
|
|
|
|
|
|
class TestRemoteAZURE(TestCase):
|
|
container_name = "container-name"
|
|
connection_string = (
|
|
"DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;"
|
|
"AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsu"
|
|
"Fq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;"
|
|
"BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;"
|
|
)
|
|
|
|
def test_init_compat(self):
|
|
url = (
|
|
"azure://ContainerName={container_name};{connection_string}"
|
|
).format(
|
|
container_name=self.container_name,
|
|
connection_string=self.connection_string,
|
|
)
|
|
config = {"url": url}
|
|
remote = RemoteAZURE(None, config)
|
|
self.assertEqual(remote.path_info, "azure://" + self.container_name)
|
|
self.assertEqual(remote.connection_string, self.connection_string)
|
|
|
|
def test_init(self):
|
|
prefix = "some/prefix"
|
|
url = "azure://{}/{}".format(self.container_name, prefix)
|
|
config = {"url": url, "connection_string": self.connection_string}
|
|
remote = RemoteAZURE(None, config)
|
|
self.assertEqual(remote.path_info, url)
|
|
self.assertEqual(remote.connection_string, self.connection_string)
|