Skip to content

Commit

Permalink
chore(commands): fix types, reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
maugde committed Jan 9, 2025
1 parent c37e3c0 commit b6a58a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion antarest/login/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get_current_user() -> Optional[JWTUser]:


@contextlib.contextmanager
def current_user_context(token: JWTUser) -> t.Generator[JWTUser|None]:
def current_user_context(token: JWTUser) -> t.Iterator[JWTUser|None]:
global _current_user
jwt_user = token
_current_user.set(jwt_user)
Expand Down
9 changes: 3 additions & 6 deletions tests/storage/business/test_arealink_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def matrix_service_fixture(tmp_path: Path) -> SimpleMatrixService:
)
return SimpleMatrixService(matrix_content_repository=matrix_content_repository)


@current_user_context(token=DEFAULT_ADMIN_USER)
@with_db_context
def test_area_crud(empty_study: FileStudy, matrix_service: SimpleMatrixService):
Expand Down Expand Up @@ -125,9 +126,7 @@ def test_area_crud(empty_study: FileStudy, matrix_service: SimpleMatrixService):

area_manager.create_area(study, AreaCreationDTO(name="test", type=AreaType.AREA))
assert len(empty_study.config.areas.keys()) == 1
assert (
json.loads((empty_study.config.study_path / "patch.json").read_text())["areas"]["test"]["country"] is None
)
assert json.loads((empty_study.config.study_path / "patch.json").read_text())["areas"]["test"]["country"] is None

area_manager.update_area_ui(study, "test", UpdateAreaUi(x=100, y=200, color_rgb=(255, 0, 100)))
assert empty_study.tree.get(["input", "areas", "test", "ui", "ui"]) == {
Expand Down Expand Up @@ -176,9 +175,7 @@ def test_area_crud(empty_study: FileStudy, matrix_service: SimpleMatrixService):
RequestParameters(DEFAULT_ADMIN_USER),
)
assert (empty_study.config.study_path / "patch.json").exists()
assert (
json.loads((empty_study.config.study_path / "patch.json").read_text())["areas"]["test"]["country"] == "FR"
)
assert json.loads((empty_study.config.study_path / "patch.json").read_text())["areas"]["test"]["country"] == "FR"

area_manager.update_area_ui(study, "test", UpdateAreaUi(x=100, y=200, color_rgb=(255, 0, 100)))
variant_study_service.append_commands.assert_called_with(
Expand Down

0 comments on commit b6a58a4

Please sign in to comment.