logo
This commit is contained in:
1 parent
17baba1490
commit
4fcefd7fb7
4 files changed
+38
No files matched your search
@@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"image/png"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -127,3 +128,21 @@ func TestBuildHistoryChart(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLogoServedAsPng(t *testing.T) {
|
||||
srv := server.New("secret", 0, &store.Store{}, embeddedStatic)
|
||||
req := httptest.NewRequest(http.MethodGet, "/logo.png", nil)
|
||||
rec := httptest.NewRecorder()
|
||||
|
||||
srv.Routes().ServeHTTP(rec, req)
|
||||
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d, want %d", rec.Code, http.StatusOK)
|
||||
}
|
||||
if got := rec.Header().Get("Content-Type"); got != "image/png" {
|
||||
t.Fatalf("content-type = %q, want image/png", got)
|
||||
}
|
||||
if _, err := png.Decode(bytes.NewReader(rec.Body.Bytes())); err != nil {
|
||||
t.Fatalf("logo is not a valid png: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user