|
22 | 22 | from faker import Faker |
23 | 23 | from playwright.sync_api import APIRequestContext, BrowserContext, Page, WebSocket |
24 | 24 | from playwright.sync_api._generated import Playwright |
25 | | -from pydantic import AnyUrl, SecretStr, TypeAdapter |
| 25 | +from pydantic import AnyUrl, TypeAdapter |
26 | 26 | from pytest_simcore.helpers.faker_factories import DEFAULT_TEST_PASSWORD |
27 | 27 | from pytest_simcore.helpers.logging_tools import log_context |
28 | 28 | from pytest_simcore.helpers.playwright import ( |
|
37 | 37 | decode_socketio_42_message, |
38 | 38 | web_socket_default_log_handler, |
39 | 39 | ) |
| 40 | +from pytest_simcore.helpers.pydantic_ext import Secret4TestsStr |
40 | 41 |
|
41 | 42 | _PROJECT_CLOSING_TIMEOUT: Final[int] = 10 * MINUTE |
42 | 43 | _OPENING_NEW_EMPTY_PROJECT_MAX_WAIT_TIME: Final[int] = 30 * SECOND |
@@ -178,7 +179,7 @@ def pytest_runtest_makereport(item: pytest.Item, call): |
178 | 179 | ) |
179 | 180 | diagnostics["duration"] = str(end_time - start_time) |
180 | 181 |
|
181 | | - print(f"\nDiagnostics report for {test_name} ---") # noqa: RUF001 |
| 182 | + print(f"\nDiagnostics report for {test_name} ---") # noqa: RUF001 |
182 | 183 | print(textwrap.indent(json.dumps(diagnostics, indent=2), " ")) |
183 | 184 | print("---") |
184 | 185 |
|
@@ -221,13 +222,13 @@ def user_name(request: pytest.FixtureRequest, auto_register: bool, faker: Faker) |
221 | 222 | @pytest.fixture |
222 | 223 | def user_password( |
223 | 224 | request: pytest.FixtureRequest, auto_register: bool, faker: Faker |
224 | | -) -> SecretStr: |
| 225 | +) -> Secret4TestsStr: |
225 | 226 | if auto_register: |
226 | | - return SecretStr(DEFAULT_TEST_PASSWORD) |
| 227 | + return Secret4TestsStr(DEFAULT_TEST_PASSWORD) |
227 | 228 | if osparc_password := request.config.getoption("--password"): |
228 | 229 | assert isinstance(osparc_password, str) |
229 | | - return SecretStr(osparc_password) |
230 | | - return SecretStr(os.environ["USER_PASSWORD"]) |
| 230 | + return Secret4TestsStr(osparc_password) |
| 231 | + return Secret4TestsStr(os.environ["USER_PASSWORD"]) |
231 | 232 |
|
232 | 233 |
|
233 | 234 | @pytest.fixture(scope="session") |
@@ -290,7 +291,7 @@ def register( |
290 | 291 | page: Page, |
291 | 292 | product_url: AnyUrl, |
292 | 293 | user_name: str, |
293 | | - user_password: SecretStr, |
| 294 | + user_password: Secret4TestsStr, |
294 | 295 | ) -> Callable[[], AutoRegisteredUser]: |
295 | 296 | def _do() -> AutoRegisteredUser: |
296 | 297 | with log_context( |
@@ -323,7 +324,7 @@ def log_in_and_out( |
323 | 324 | page: Page, |
324 | 325 | product_url: AnyUrl, |
325 | 326 | user_name: str, |
326 | | - user_password: SecretStr, |
| 327 | + user_password: Secret4TestsStr, |
327 | 328 | auto_register: bool, |
328 | 329 | register: Callable[[], AutoRegisteredUser], |
329 | 330 | ) -> Iterator[WebSocket]: |
|
0 commit comments