From 24bc3a52b9c8294d88ef54a0df00e31e8a434f05 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Mon, 10 Jan 2022 02:13:45 +0100 Subject: [PATCH 1/2] chore: ignore intermediate coverage artifacts --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 80f96bb7f..a395a5608 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ MANIFEST .idea/ coverage.xml docs/_build -.coverage +.coverage* .python-version .tox .venv/ From 5e178857d51eae44e6feba4a05d0dd39a41d5fe0 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Mon, 10 Jan 2022 02:27:26 +0100 Subject: [PATCH 2/2] 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 000000000..1580621d7 --- /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()