mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-12 02:18:52 +00:00
fix: use tagged switch for staticcheck QF1002 in sectigo tests
Convert 3 untagged switch statements to tagged `switch r.URL.Path {}`
form to satisfy staticcheck QF1002. No behavioral change.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -250,11 +250,11 @@ func TestSectigoConnector(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("IssueCertificate_Pending", func(t *testing.T) {
|
t.Run("IssueCertificate_Pending", func(t *testing.T) {
|
||||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
switch {
|
switch r.URL.Path {
|
||||||
case r.URL.Path == "/ssl/v1/enroll":
|
case "/ssl/v1/enroll":
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(`{"sslId":55002}`))
|
w.Write([]byte(`{"sslId":55002}`))
|
||||||
case r.URL.Path == "/ssl/v1/55002":
|
case "/ssl/v1/55002":
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(`{"sslId":55002,"status":"Applied","commonName":"secure.example.com"}`))
|
w.Write([]byte(`{"sslId":55002,"status":"Applied","commonName":"secure.example.com"}`))
|
||||||
default:
|
default:
|
||||||
@@ -470,11 +470,11 @@ func TestSectigoConnector(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("RenewCertificate_NewOrder", func(t *testing.T) {
|
t.Run("RenewCertificate_NewOrder", func(t *testing.T) {
|
||||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
switch {
|
switch r.URL.Path {
|
||||||
case r.URL.Path == "/ssl/v1/enroll":
|
case "/ssl/v1/enroll":
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(`{"sslId":55010}`))
|
w.Write([]byte(`{"sslId":55010}`))
|
||||||
case r.URL.Path == "/ssl/v1/55010":
|
case "/ssl/v1/55010":
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(`{"sslId":55010,"status":"Applied"}`))
|
w.Write([]byte(`{"sslId":55010,"status":"Applied"}`))
|
||||||
default:
|
default:
|
||||||
@@ -680,11 +680,11 @@ func TestSectigoConnector(t *testing.T) {
|
|||||||
t.Errorf("Request %d: expected password 'verify-pass', got '%s'", requestCount, r.Header.Get("password"))
|
t.Errorf("Request %d: expected password 'verify-pass', got '%s'", requestCount, r.Header.Get("password"))
|
||||||
}
|
}
|
||||||
|
|
||||||
switch {
|
switch r.URL.Path {
|
||||||
case r.URL.Path == "/ssl/v1/enroll":
|
case "/ssl/v1/enroll":
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(`{"sslId":55050}`))
|
w.Write([]byte(`{"sslId":55050}`))
|
||||||
case r.URL.Path == "/ssl/v1/55050":
|
case "/ssl/v1/55050":
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(`{"sslId":55050,"status":"Applied"}`))
|
w.Write([]byte(`{"sslId":55050,"status":"Applied"}`))
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user