diff --git a/tests/test_auth.py b/tests/test_auth.py index b0b17dc2..4c1624a4 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -10,6 +10,7 @@ from ixmp4.core.exceptions import Forbidden, InvalidCredentials from ixmp4.data.backend import SqlAlchemyBackend +from .core.test_run import assert_cloned_run from .fixtures import SmallIamcDataset @@ -235,6 +236,9 @@ def test_guards( # their property https://github.com/python/mypy/issues/3004 run.meta = {"meta": "test"} # type: ignore[assignment] + with pytest.raises(Forbidden): + _ = run.clone() + def test_run_audit_info(self, db_platform: ixmp4.Platform) -> None: backend = cast(SqlAlchemyBackend, db_platform.backend) @@ -312,6 +316,10 @@ def test_filters( ) run.meta = {"meta": "test"} # type: ignore[assignment] + # Test run.clone() uses auth() + clone_with_solution = run.clone() + assert_cloned_run(run, clone_with_solution, kept_solution=True) + else: with pytest.raises(Forbidden): _ = mp.runs.create(model, "Scenario") @@ -327,6 +335,9 @@ def test_filters( with pytest.raises(Forbidden): run.meta = {"meta": "test"} # type: ignore[assignment] + + with pytest.raises(Forbidden): + _ = run.clone() else: with pytest.raises((ixmp4.Run.NotFound, ixmp4.Run.NoDefaultVersion)): mp.runs.get(model, "Scenario")