Skip to content

Commit 0d8c1ba

Browse files
author
Andrei Neagu
committed
added tests
1 parent 5758507 commit 0d8c1ba

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

services/director-v2/tests/unit/test_modules_osparc_variables.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from models_library.users import UserID
2323
from models_library.utils.specs_substitution import SubstitutionValue
2424
from models_library.utils.string_substitution import OSPARC_IDENTIFIER_PREFIX
25+
from models_library.wallets import WalletID
2526
from pydantic import TypeAdapter
2627
from pytest_mock import MockerFixture
2728
from pytest_simcore.helpers.faker_compose_specs import generate_fake_docker_compose
@@ -159,11 +160,13 @@ async def fake_app(faker: Faker) -> AsyncIterable[FastAPI]:
159160
yield app
160161

161162

163+
@pytest.mark.parametrize("wallet_id", [None, 12])
162164
async def test_resolve_and_substitute_session_variables_in_specs(
163165
mock_user_repo: None,
164166
mock_osparc_variables_api_auth_rpc: None,
165167
fake_app: FastAPI,
166168
faker: Faker,
169+
wallet_id: WalletID | None,
167170
):
168171
specs = {
169172
"product_name": "${OSPARC_VARIABLE_PRODUCT_NAME}",
@@ -175,6 +178,7 @@ async def test_resolve_and_substitute_session_variables_in_specs(
175178
"api_key": "${OSPARC_VARIABLE_API_KEY}",
176179
"api_secret": "${OSPARC_VARIABLE_API_SECRET}",
177180
"service_run_id": "${OSPARC_VARIABLE_SERVICE_RUN_ID}",
181+
"wallet_id": "${OSPARC_VARIABLE_WALLET_ID}",
178182
}
179183
print("SPECS\n", specs)
180184

@@ -186,10 +190,12 @@ async def test_resolve_and_substitute_session_variables_in_specs(
186190
project_id=faker.uuid4(cast_to=None),
187191
node_id=faker.uuid4(cast_to=None),
188192
service_run_id=ServiceRunID("some_run_id"),
193+
wallet_id=wallet_id,
189194
)
190195
print("REPLACED SPECS\n", replaced_specs)
191196

192197
assert OSPARC_IDENTIFIER_PREFIX not in f"{replaced_specs}"
198+
assert f"{'' if wallet_id is None else wallet_id}" in f"{replaced_specs}"
193199

194200

195201
@pytest.fixture

0 commit comments

Comments
 (0)