Get or create the demo client (represents client application).
(server, user)
| 97 | |
| 98 | @pytest_asyncio.fixture(scope="module", loop_scope="module") |
| 99 | async def client(server, user): |
| 100 | """Get or create the demo client (represents client application).""" |
| 101 | client_id = "demo-client-app" |
| 102 | |
| 103 | # Try to get existing client |
| 104 | try: |
| 105 | client = await server.client_manager.get_client_by_id(client_id) |
| 106 | if client: |
| 107 | return client |
| 108 | except Exception: |
| 109 | pass |
| 110 | |
| 111 | # Create client |
| 112 | client = await server.client_manager.create_client( |
| 113 | pydantic_client=Client( |
| 114 | id=client_id, |
| 115 | name=client_id, |
| 116 | organization_id=user.organization_id, |
| 117 | status="active", |
| 118 | write_scope="test", |
| 119 | read_scopes=["test"], |
| 120 | ) |
| 121 | ) |
| 122 | |
| 123 | return client |
| 124 | |
| 125 | |
| 126 | @pytest_asyncio.fixture(scope="module", loop_scope="module") |
nothing calls this directly
no test coverage detected