MCPcopy Index your code
hub / github.com/appleboy/CodeGPT / TestGetAPIKeyFromHelperWithCache_NoCaching

Function TestGetAPIKeyFromHelperWithCache_NoCaching

util/api_key_helper_test.go:220–241  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

218}
219
220func TestGetAPIKeyFromHelperWithCache_NoCaching(t *testing.T) {
221 overrideCredStore(t)
222 // Test with refreshInterval = 0 (no caching)
223 command := "echo 'test-key-no-cache'"
224
225 key1, err := GetAPIKeyFromHelperWithCache(context.Background(), command, 0)
226 if err != nil {
227 t.Fatalf("GetAPIKeyFromHelperWithCache() error = %v", err)
228 }
229 if key1 != "test-key-no-cache" {
230 t.Errorf("Expected 'test-key-no-cache', got %q", key1)
231 }
232
233 // Second call should also execute (no caching)
234 key2, err := GetAPIKeyFromHelperWithCache(context.Background(), command, 0)
235 if err != nil {
236 t.Fatalf("GetAPIKeyFromHelperWithCache() error = %v", err)
237 }
238 if key2 != "test-key-no-cache" {
239 t.Errorf("Expected 'test-key-no-cache', got %q", key2)
240 }
241}
242
243func TestGetAPIKeyFromHelperWithCache_WithCaching(t *testing.T) {
244 overrideCredStore(t)

Callers

nothing calls this directly

Calls 2

overrideCredStoreFunction · 0.85

Tested by

no test coverage detected