| 16 | namespace test { |
| 17 | |
| 18 | class OpenAIIntegrationTest : public AITestFixture { |
| 19 | protected: |
| 20 | void SetUp() override { |
| 21 | AITestFixture::SetUp(); |
| 22 | |
| 23 | // Check if we should run real API tests |
| 24 | const char* api_key = std::getenv("OPENAI_API_KEY"); |
| 25 | |
| 26 | if (api_key && *api_key != '\0') { |
| 27 | use_real_api_ = true; |
| 28 | client_ = ai::openai::create_client(api_key); |
| 29 | } else { |
| 30 | use_real_api_ = false; |
| 31 | // Skip tests if no API key is available |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | void TearDown() override { AITestFixture::TearDown(); } |
| 36 | |
| 37 | bool use_real_api_; |
| 38 | std::optional<ai::Client> client_; |
| 39 | }; |
| 40 | |
| 41 | // Basic API Connectivity Tests |
| 42 | TEST_F(OpenAIIntegrationTest, BasicTextGeneration) { |
nothing calls this directly
no outgoing calls
no test coverage detected