Skip to content

Commit

Permalink
Add test that run.clone uses auth system
Browse files Browse the repository at this point in the history
  • Loading branch information
glatterf42 committed Jan 8, 2025
1 parent 0975ce3 commit 02694e6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand Down

0 comments on commit 02694e6

Please sign in to comment.