| 12345678910111213141516171819202122232425262728293031323334353637 | import pytestfrom clean_python.oauth2.client_credentials import CCTokenGatewayfrom clean_python.oauth2.client_credentials import is_token_usablefrom clean_python.oauth2.client_credentials import OAuth2CCSettingsfrom clean_python.oauth2.client_credentials import SyncCCTokenGateway@pytest.fixturedef settings(fastapi_example_app) -> OAuth2CCSettings:    # these settings match those hardcoded in the example app    return OAuth2CCSettings(        token_url=fastapi_example_app + "/v1/token",        client_id="testclient",        client_secret="supersecret",        scope="all",    )@pytest.fixturedef gateway(settings) -> CCTokenGateway:    return CCTokenGateway(settings)async def test_fetch_token(gateway: CCTokenGateway):    response = await gateway._fetch_token()    assert is_token_usable(response, 0)@pytest.fixturedef sync_gateway(settings) -> SyncCCTokenGateway:    return SyncCCTokenGateway(settings)def test_fetch_token_sync(sync_gateway: SyncCCTokenGateway):    response = sync_gateway._fetch_token()    assert is_token_usable(response, 0)
 |