|
3 | 3 | from pathlib import Path |
4 | 4 |
|
5 | 5 | import pytest |
6 | | -from notifications_python_client import NotificationsAPIClient |
7 | 6 | from selenium import webdriver |
8 | 7 | from selenium.webdriver.chrome.service import Service as ChromeService |
9 | 8 | from selenium.webdriver.support.events import EventFiringWebDriver |
|
12 | 11 | from tests.event_listener import LoggingEventListener |
13 | 12 | from tests.pages.pages import HomePage |
14 | 13 | from tests.pages.rollups import sign_in, sign_in_email_auth |
| 14 | +from tests.test_utils import FTNotificationsAPIClient |
15 | 15 |
|
16 | 16 |
|
17 | 17 | def pytest_addoption(parser): |
@@ -124,12 +124,28 @@ def login_seeded_user(_driver, request: pytest.FixtureRequest): |
124 | 124 |
|
125 | 125 |
|
126 | 126 | @pytest.fixture(scope="module") |
127 | | -def client_live_key(): |
128 | | - client = NotificationsAPIClient(base_url=config["notify_api_url"], api_key=config["service"]["api_live_key"]) |
| 127 | +def _client_live_key(): |
| 128 | + client = FTNotificationsAPIClient(base_url=config["notify_api_url"], api_key=config["service"]["api_live_key"]) |
129 | 129 | return client |
130 | 130 |
|
131 | 131 |
|
132 | 132 | @pytest.fixture(scope="module") |
133 | | -def client_test_key(): |
134 | | - client = NotificationsAPIClient(base_url=config["notify_api_url"], api_key=config["service"]["api_test_key"]) |
| 133 | +def _client_test_key(): |
| 134 | + client = FTNotificationsAPIClient(base_url=config["notify_api_url"], api_key=config["service"]["api_test_key"]) |
135 | 135 | return client |
| 136 | + |
| 137 | + |
| 138 | +@pytest.fixture(scope="function") |
| 139 | +def client_live_key(_client_live_key, request): |
| 140 | + prev_failed_tests = request.session.testsfailed |
| 141 | + yield _client_live_key |
| 142 | + if prev_failed_tests != request.session.testsfailed: |
| 143 | + print("client_live_key client id:", str(getattr(_client_live_key, "_client_id", None))) # noqa: T201 |
| 144 | + |
| 145 | + |
| 146 | +@pytest.fixture(scope="function") |
| 147 | +def client_test_key(_client_test_key, request): |
| 148 | + prev_failed_tests = request.session.testsfailed |
| 149 | + yield _client_test_key |
| 150 | + if prev_failed_tests != request.session.testsfailed: |
| 151 | + print("client_test_key client id:", str(getattr(_client_test_key, "_client_id", None))) # noqa: T201 |
0 commit comments