From 5e178857d51eae44e6feba4a05d0dd39a41d5fe0 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Mon, 10 Jan 2022 02:27:26 +0100 Subject: test(functional): check mixin behavior with lazy objects --- tests/functional/api/test_mixins.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/functional/api/test_mixins.py diff --git a/tests/functional/api/test_mixins.py b/tests/functional/api/test_mixins.py new file mode 100644 index 0000000..1580621 --- /dev/null +++ b/tests/functional/api/test_mixins.py @@ -0,0 +1,23 @@ +import pytest + + +@pytest.fixture +def lazy_project(gl, project): + return gl.projects.get(project.path_with_namespace, lazy=True) + + +def test_refresh_after_lazy_get_with_path(project, lazy_project): + lazy_project.refresh() + assert lazy_project.id == project.id + + +def test_save_after_lazy_get_with_path(project, lazy_project): + lazy_project.description = "A new description" + lazy_project.save() + assert lazy_project.id == project.id + assert lazy_project.description == "A new description" + + +@pytest.mark.xfail(reason="See #1494") +def test_delete_after_lazy_get_with_path(gl, lazy_project): + lazy_project.delete() -- cgit v1.2.1