MCPcopy Create free account
hub / github.com/cronitorio/cronitor-cli / TestVersionHeader_SentWhenConfigured

Function TestVersionHeader_SentWhenConfigured

lib/api_client_test.go:1192–1211  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1190}
1191
1192func TestVersionHeader_SentWhenConfigured(t *testing.T) {
1193 mock := testutil.NewMockAPI()
1194 defer mock.Close()
1195
1196 mock.On("GET", "/monitors", 200, `{}`)
1197
1198 viper.Set("CRONITOR_API_VERSION", "2025-11-28")
1199 defer viper.Set("CRONITOR_API_VERSION", "")
1200
1201 client := newTestClient(mock.Server.URL)
1202 _, err := client.GET("/monitors", nil)
1203 if err != nil {
1204 t.Fatalf("unexpected error: %v", err)
1205 }
1206
1207 req := mock.LastRequest()
1208 if cv := req.Headers.Get("Cronitor-Version"); cv != "2025-11-28" {
1209 t.Errorf("expected Cronitor-Version 2025-11-28, got %q", cv)
1210 }
1211}
1212
1213func TestVersionHeader_DifferentVersionValues(t *testing.T) {
1214 mock := testutil.NewMockAPI()

Callers

nothing calls this directly

Calls 7

CloseMethod · 0.95
OnMethod · 0.95
LastRequestMethod · 0.95
NewMockAPIFunction · 0.92
newTestClientFunction · 0.85
GETMethod · 0.80
GetMethod · 0.80

Tested by

no test coverage detected