Get a function that returns the active token. Args: background_task: harness for BackgroundTask app. driver: WebDriver instance. Returns: The token for the connected client
(background_task: AppHarness, driver: WebDriver)
| 258 | |
| 259 | @pytest.fixture |
| 260 | def token(background_task: AppHarness, driver: WebDriver) -> str: |
| 261 | """Get a function that returns the active token. |
| 262 | |
| 263 | Args: |
| 264 | background_task: harness for BackgroundTask app. |
| 265 | driver: WebDriver instance. |
| 266 | |
| 267 | Returns: |
| 268 | The token for the connected client |
| 269 | """ |
| 270 | assert background_task.app_instance is not None |
| 271 | |
| 272 | token_input = AppHarness.poll_for_or_raise_timeout( |
| 273 | lambda: driver.find_element(By.ID, "token") |
| 274 | ) |
| 275 | |
| 276 | # wait for the backend connection to send the token |
| 277 | token = background_task.poll_for_value(token_input, timeout=DEFAULT_TIMEOUT * 2) |
| 278 | assert token is not None |
| 279 | |
| 280 | return token |
| 281 | |
| 282 | |
| 283 | def test_background_task( |
nothing calls this directly
no test coverage detected