summaryrefslogtreecommitdiff
path: root/gitlab/tests/test_cli.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/tests/test_cli.py')
-rw-r--r--gitlab/tests/test_cli.py37
1 files changed, 27 insertions, 10 deletions
diff --git a/gitlab/tests/test_cli.py b/gitlab/tests/test_cli.py
index aed9fc4..6f67e8f 100644
--- a/gitlab/tests/test_cli.py
+++ b/gitlab/tests/test_cli.py
@@ -28,20 +28,37 @@ import pytest
from gitlab import cli
-def test_what_to_cls():
- assert "Foo" == cli.what_to_cls("foo")
- assert "FooBar" == cli.what_to_cls("foo-bar")
+@pytest.mark.parametrize(
+ "what,expected_class",
+ [
+ ("class", "Class"),
+ ("test-class", "TestClass"),
+ ("test-longer-class", "TestLongerClass"),
+ ],
+)
+def test_what_to_cls(what, expected_class):
+ def _namespace():
+ pass
+ ExpectedClass = type(expected_class, (), {})
+ _namespace.__dict__[expected_class] = ExpectedClass
-def test_cls_to_what():
- class Class(object):
- pass
+ assert cli.what_to_cls(what, _namespace) == ExpectedClass
- class TestClass(object):
- pass
- assert "test-class" == cli.cls_to_what(TestClass)
- assert "class" == cli.cls_to_what(Class)
+@pytest.mark.parametrize(
+ "class_name,expected_what",
+ [
+ ("Class", "class"),
+ ("TestClass", "test-class"),
+ ("TestUPPERCASEClass", "test-uppercase-class"),
+ ("UPPERCASETestClass", "uppercase-test-class"),
+ ],
+)
+def test_cls_to_what(class_name, expected_what):
+ TestClass = type(class_name, (), {})
+
+ assert cli.cls_to_what(TestClass) == expected_what
def test_die():