Skip to content

Commit

Permalink
Merge pull request #1400 from JohnVillalovos/jlvillal/sanitize
Browse files Browse the repository at this point in the history
chore: remove unused function sanitize_parameters()
  • Loading branch information
max-wittig committed Apr 20, 2021
2 parents 5b18d20 + 443b934 commit dd236a0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
20 changes: 0 additions & 20 deletions gitlab/tests/test_utils.py
Expand Up @@ -40,23 +40,3 @@ def test_sanitized_url():
src = "http://localhost/foo.bar.baz"
dest = "http://localhost/foo%2Ebar%2Ebaz"
assert dest == utils.sanitized_url(src)


def test_sanitize_parameters_does_nothing():
assert 1 == utils.sanitize_parameters(1)
assert 1.5 == utils.sanitize_parameters(1.5)
assert "foo" == utils.sanitize_parameters("foo")


def test_sanitize_parameters_slash():
assert "foo%2Fbar" == utils.sanitize_parameters("foo/bar")


def test_sanitize_parameters_slash_and_percent():
assert "foo%2Fbar%25quuz" == utils.sanitize_parameters("foo/bar%quuz")


def test_sanitize_parameters_dict():
source = {"url": "foo/bar", "id": 1}
expected = {"url": "foo%2Fbar", "id": 1}
assert expected == utils.sanitize_parameters(source)
8 changes: 0 additions & 8 deletions gitlab/utils.py
Expand Up @@ -60,14 +60,6 @@ def clean_str_id(id: str) -> str:
return quote(id, safe="")


def sanitize_parameters(value):
if isinstance(value, dict):
return dict((k, sanitize_parameters(v)) for k, v in value.items())
if isinstance(value, str):
return quote(value, safe="")
return value


def sanitized_url(url: str) -> str:
parsed = urlparse(url)
new_path = parsed.path.replace(".", "%2E")
Expand Down

0 comments on commit dd236a0

Please sign in to comment.