Fixture to provide an initialized AgentOps client.
(mock_api_key, monkeypatch)
| 22 | |
| 23 | @pytest.fixture |
| 24 | def agentops_client(mock_api_key, monkeypatch): |
| 25 | """Fixture to provide an initialized AgentOps client.""" |
| 26 | # Create a mock auth response |
| 27 | mock_auth = MagicMock() |
| 28 | mock_auth.authenticate = lambda x: True |
| 29 | mock_auth.is_authenticated = True |
| 30 | |
| 31 | # Create the client |
| 32 | client = Client() |
| 33 | |
| 34 | # Mock the auth module |
| 35 | monkeypatch.setattr(client, "api", MagicMock(auth=mock_auth)) |
| 36 | |
| 37 | # Initialize with mock key |
| 38 | client.init(api_key=mock_api_key) |
| 39 | return client |
| 40 | |
| 41 | |
| 42 | @pytest.fixture |