-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DM-37917: Add testing against real webDAV server for HttpResourcePath #40
Changes from 14 commits
a9b6f21
0469e84
a5a5f12
e0e5ac1
9ac5a1d
632155b
5bbe8c0
108c893
f7fe03f
3ce43db
b79d643
d52dd73
554afff
d56425f
459bccf
260b147
a7a3d9d
3d556fc
67e387f
db184ba
6b8a6bb
4087c3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ | |
import logging | ||
import os | ||
import pathlib | ||
import random | ||
import string | ||
import unittest | ||
import urllib.parse | ||
import uuid | ||
|
@@ -119,6 +121,7 @@ class _GenericTestCase: | |
|
||
scheme: Optional[str] = None | ||
netloc: Optional[str] = None | ||
base_path: Optional[str] = None | ||
path1 = "test_dir" | ||
path2 = "file.txt" | ||
|
||
|
@@ -142,8 +145,13 @@ def _make_uri(self, path: str, netloc: Optional[str] = None) -> str: | |
if self.scheme is not None: | ||
if netloc is None: | ||
netloc = self.netloc | ||
|
||
path = path.lstrip("/") | ||
if self.base_path is not None: | ||
path = self.base_path.strip("/") + "/" + path | ||
if path.startswith("/"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment above. |
||
path = path[1:] | ||
|
||
return f"{self.scheme}://{netloc}/{path}" | ||
else: | ||
return path | ||
|
@@ -428,7 +436,10 @@ def setUp(self) -> None: | |
self.tmpdir = ResourcePath(makeTestTempDir(self.testdir)) | ||
else: | ||
# Create tmp directory relative to the test root. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe change to "Create random tmp directory" |
||
self.tmpdir = self.root_uri.join("TESTING/") | ||
self.tmpdir = self.root_uri.join( | ||
"TESTING-" + "".join(random.choices(string.ascii_lowercase + string.digits, k=8)), | ||
forceDirectory=True, | ||
) | ||
self.tmpdir.mkdir() | ||
|
||
def tearDown(self) -> None: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably clearer to do:
since that will take care of the trailing slash automatically.