1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
from gitlab import base
from tests.unit import helpers
def test_computed_path_simple(gl):
class MGR(base.RESTManager):
_path = "/tests"
_obj_cls = object
mgr = MGR(gl)
assert mgr._computed_path == "/tests"
def test_computed_path_with_parent(gl, fake_manager):
class MGR(base.RESTManager):
_path = "/tests/{test_id}/cases"
_obj_cls = object
_from_parent_attrs = {"test_id": "id"}
mgr = MGR(gl, parent=helpers.FakeParent(manager=fake_manager, attrs={}))
assert mgr._computed_path == "/tests/42/cases"
def test_path_property(gl):
class MGR(base.RESTManager):
_path = "/tests"
_obj_cls = object
mgr = MGR(gl)
assert mgr.path == "/tests"
|