Basic API Connectivity Tests
| 40 | |
| 41 | // Basic API Connectivity Tests |
| 42 | TEST_F(OpenAIIntegrationTest, BasicTextGeneration) { |
| 43 | if (!use_real_api_) { |
| 44 | GTEST_SKIP() << "No OPENAI_API_KEY environment variable set"; |
| 45 | } |
| 46 | |
| 47 | GenerateOptions options(ai::openai::models::kGpt4oMini, |
| 48 | "Hello, how are you?"); |
| 49 | auto result = client_->generate_text(options); |
| 50 | |
| 51 | TestAssertions::assertSuccess(result); |
| 52 | EXPECT_FALSE(result.text.empty()); |
| 53 | EXPECT_GT(result.usage.total_tokens, 0); |
| 54 | |
| 55 | if (result.id.has_value()) { |
| 56 | EXPECT_FALSE(result.id->empty()); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | TEST_F(OpenAIIntegrationTest, TextGenerationWithSystemPrompt) { |
| 61 | if (!use_real_api_) { |
nothing calls this directly
no test coverage detected