MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / TestCheckForUpdate_RateLimited

Function TestCheckForUpdate_RateLimited

internal/update/update_test.go:105–121  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

103}
104
105func TestCheckForUpdate_RateLimited(t *testing.T) {
106 srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
107 w.WriteHeader(http.StatusForbidden)
108 }))
109 defer srv.Close()
110
111 result, err := CheckForUpdate("0.5.0", Options{ReleasesURL: srv.URL})
112 if err != nil {
113 t.Fatalf("expected no error for rate-limited response, got: %v", err)
114 }
115 if result.UpdateAvailable {
116 t.Error("expected no update when rate limited")
117 }
118 if result.CurrentVersion != "0.5.0" {
119 t.Errorf("expected current version 0.5.0, got %s", result.CurrentVersion)
120 }
121}
122
123func TestCheckForUpdate_APIError(t *testing.T) {
124 srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 1

CheckForUpdateFunction · 0.85

Tested by

no test coverage detected