summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/api/test_lazy_objects.py2
-rw-r--r--tests/unit/test_utils.py25
2 files changed, 3 insertions, 24 deletions
diff --git a/tests/functional/api/test_lazy_objects.py b/tests/functional/api/test_lazy_objects.py
index 3db7a60..78ade80 100644
--- a/tests/functional/api/test_lazy_objects.py
+++ b/tests/functional/api/test_lazy_objects.py
@@ -12,7 +12,7 @@ def lazy_project(gl, project):
def test_lazy_id(project, lazy_project):
assert isinstance(lazy_project.id, str)
assert isinstance(lazy_project.id, gitlab.utils.EncodedId)
- assert lazy_project.id == gitlab.utils._url_encode(project.path_with_namespace)
+ assert lazy_project.id == gitlab.utils.EncodedId(project.path_with_namespace)
def test_refresh_after_lazy_get_with_path(project, lazy_project):
diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py
index cccab9d..9f90983 100644
--- a/tests/unit/test_utils.py
+++ b/tests/unit/test_utils.py
@@ -20,28 +20,10 @@ import json
from gitlab import utils
-def test_url_encode():
- src = "nothing_special"
- dest = "nothing_special"
- assert dest == utils._url_encode(src)
-
- src = "foo#bar/baz/"
- dest = "foo%23bar%2Fbaz%2F"
- assert dest == utils._url_encode(src)
-
- src = "foo%bar/baz/"
- dest = "foo%25bar%2Fbaz%2F"
- assert dest == utils._url_encode(src)
-
- # periods/dots should not be modified
- src = "docs/README.md"
- dest = "docs%2FREADME.md"
- assert dest == utils._url_encode(src)
-
-
class TestEncodedId:
def test_init_str(self):
obj = utils.EncodedId("Hello")
+ assert "Hello" == obj
assert "Hello" == str(obj)
assert "Hello" == f"{obj}"
@@ -51,6 +33,7 @@ class TestEncodedId:
def test_init_int(self):
obj = utils.EncodedId(23)
+ assert 23 == obj
assert "23" == str(obj)
assert "23" == f"{obj}"
@@ -60,12 +43,10 @@ class TestEncodedId:
obj = utils.EncodedId(obj_init)
assert value == str(obj)
assert value == f"{obj}"
- assert value == obj.original_str
value = "we got/a/path"
expected = "we%20got%2Fa%2Fpath"
obj_init = utils.EncodedId(value)
- assert value == obj_init.original_str
assert expected == str(obj_init)
assert expected == f"{obj_init}"
# Show that no matter how many times we recursively call it we still only
@@ -75,8 +56,6 @@ class TestEncodedId:
)
assert expected == str(obj)
assert expected == f"{obj}"
- # We have stored a copy of our original string
- assert value == obj.original_str
# Show assignments still only encode once
obj2 = obj