Skip to content

Commit 57abe58

Browse files
authored
Merge pull request #7 from RachelTucker/pythonsdk-49
Added tests and fixed bug
2 parents f881095 + 6cb588c commit 57abe58

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

ds3/ds3network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def remove_http_from_endpoint(self, endpoint):
312312
if not endpoint.startswith('http'):
313313
return endpoint
314314
index = endpoint.find('://')
315-
if endpoint >= 0:
315+
if index >= 0:
316316
return endpoint[index+3:]
317317
return endpoint
318318

tests/clientTests.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,4 +1314,21 @@ def testGetBigFile(self):
13141314
f.close()
13151315
os.close(fd)
13161316
os.remove(tempname)
1317-
1317+
1318+
1319+
class Ds3NetworkTestCase(Ds3TestCase):
1320+
def testEncodingQueryParamsWithSymbols(self):
1321+
expected = "/test/path?key=value%3Bwith%20symbols"
1322+
query_params = {"key": "value;with symbols"}
1323+
1324+
result = self.client.net_client.build_path("/test/path", query_params)
1325+
1326+
self.assertEqual(result, expected)
1327+
1328+
def testEncodingPathWithObjectNameWithPlus(self):
1329+
expected = "/test/path/name%2Bwith%2Bplus"
1330+
obj_name = "name+with+plus"
1331+
1332+
result = self.client.net_client.build_path("/test/path/" + obj_name)
1333+
1334+
self.assertEqual(result, expected)

0 commit comments

Comments
 (0)