-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/v2.14.5' into dev
# Conflicts: # antarest/launcher/web.py # antarest/study/storage/rawstudy/model/filesystem/ini_file_node.py # antarest/study/storage/rawstudy/model/filesystem/matrix/input_series_matrix.py # antarest/study/storage/variantstudy/model/command/create_area.py # antarest/study/storage/variantstudy/model/command/create_renewables_cluster.py # antarest/study/storage/variantstudy/model/command/icommand.py # antarest/study/storage/variantstudy/model/command/remove_renewables_cluster.py # antarest/study/storage/variantstudy/variant_command_extractor.py # tests/integration/assets/launcher_mock.sh # tests/integration/conftest.py # tests/integration/test_studies_upgrade.py # tests/integration/variant_blueprint/test_renewable_cluster.py # tests/launcher/test_service.py # tests/storage/integration/test_exporter.py # webapp/package-lock.json
- Loading branch information
Showing
18 changed files
with
306 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
antarest/study/storage/variantstudy/model/command/remove_renewables_cluster.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
79 changes: 79 additions & 0 deletions
79
tests/integration/launcher_blueprint/test_solver_versions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
from typing import Sequence, Any | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
from starlette.testclient import TestClient | ||
|
||
|
||
@pytest.mark.integration_test | ||
class TestSolverVersions: | ||
""" | ||
The purpose of this unit test is to check the `/v1/launcher/versions` endpoint. | ||
""" | ||
|
||
def test_get_solver_versions( | ||
self, | ||
client: TestClient, | ||
user_access_token: str, | ||
) -> None: | ||
# Fetch the default server version from the configuration file. | ||
# NOTE: the value is defined in `tests/integration/assets/config.template.yml`. | ||
res = client.get( | ||
"/v1/launcher/versions", | ||
headers={"Authorization": f"Bearer {user_access_token}"}, | ||
) | ||
res.raise_for_status() | ||
actual = res.json() | ||
assert actual == ["700"] | ||
|
||
res = client.get( | ||
"/v1/launcher/versions?solver=default", | ||
headers={"Authorization": f"Bearer {user_access_token}"}, | ||
) | ||
res.raise_for_status() | ||
actual = res.json() | ||
assert actual == ["700"] | ||
|
||
res = client.get( | ||
"/v1/launcher/versions?solver=local", | ||
headers={"Authorization": f"Bearer {user_access_token}"}, | ||
) | ||
res.raise_for_status() | ||
actual = res.json() | ||
assert actual == ["700"] | ||
|
||
res = client.get( | ||
"/v1/launcher/versions?solver=slurm", | ||
headers={"Authorization": f"Bearer {user_access_token}"}, | ||
) | ||
res.raise_for_status() | ||
actual = res.json() | ||
assert actual == [] | ||
|
||
def test_get_solver_versions__default( | ||
self, | ||
client: TestClient, | ||
user_access_token: str, | ||
) -> None: | ||
""" | ||
This unit test checks that the default value | ||
of the `solver` parameter is indeed "default". | ||
""" | ||
|
||
def get_versions(_: Any, solver: str) -> Sequence[str]: | ||
# To distinguish between the default value and the local value, | ||
# we use a different value for each `solver` value. | ||
versions = {"default": ["123"], "local": ["456"], "slurm": ["798"]} | ||
return versions[solver] | ||
|
||
with patch( | ||
"antarest.launcher.service.LauncherService.get_solver_versions", | ||
new=get_versions, | ||
): | ||
res = client.get( | ||
"/v1/launcher/versions", | ||
headers={"Authorization": f"Bearer {user_access_token}"}, | ||
) | ||
res.raise_for_status() | ||
actual = res.json() | ||
assert actual == ["123"] |
Oops, something went wrong.