mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-05 15:28:27 +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.
26 lines
817 B
Python
26 lines
817 B
Python
from unittest import TestCase
|
|
|
|
from dvc.remote.oss import RemoteOSS
|
|
|
|
|
|
class TestRemoteOSS(TestCase):
|
|
bucket_name = "bucket-name"
|
|
endpoint = "endpoint"
|
|
key_id = "Fq2UVErCz4I6tq"
|
|
key_secret = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsu"
|
|
|
|
def test_init(self):
|
|
prefix = "some/prefix"
|
|
url = "oss://{}/{}".format(self.bucket_name, prefix)
|
|
config = {
|
|
"url": url,
|
|
"oss_key_id": self.key_id,
|
|
"oss_key_secret": self.key_secret,
|
|
"oss_endpoint": self.endpoint,
|
|
}
|
|
remote = RemoteOSS(None, config)
|
|
self.assertEqual(remote.path_info, url)
|
|
self.assertEqual(remote.endpoint, self.endpoint)
|
|
self.assertEqual(remote.key_id, self.key_id)
|
|
self.assertEqual(remote.key_secret, self.key_secret)
|