Fixed issue with shelly self signed certificate.
Build Docker image on push / docker (push) Successful in 20s
Build and push Docker image on tag / docker (push) Successful in 9s

This commit is contained in:
2026-08-18 01:00:56 +02:00
parent d9d989d63f
commit 9ec7a92fa1
5 changed files with 40 additions and 5 deletions
+22
View File
@@ -38,6 +38,28 @@ func TestClientGetStatusUsesStatusEndpointAndBasicAuth(t *testing.T) {
}
}
func TestClientGetStatusAcceptsUntrustedTLSCertificate(t *testing.T) {
server := httptest.NewTLSServer(http.HandlerFunc(func(response http.ResponseWriter, _ *http.Request) {
response.Header().Set("Content-Type", "application/json")
_, _ = response.Write([]byte(`{"serial":42}`))
}))
defer server.Close()
client, err := NewClient(server.URL, "", "", time.Second)
if err != nil {
t.Fatal(err)
}
var status struct {
Serial int `json:"serial"`
}
if err := client.GetStatus(context.Background(), &status); err != nil {
t.Fatalf("GetStatus() returned an unexpected TLS certificate error: %v", err)
}
if status.Serial != 42 {
t.Fatalf("Serial = %d, want 42", status.Serial)
}
}
func TestClientGetStatusReportsHTTPError(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, _ *http.Request) {
http.Error(response, "not authorized", http.StatusUnauthorized)