From a6a774dee08317a1314e81876dfb488c74f8ec64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=B6hling=2C=20Maximilian?= Date: Fri, 29 Nov 2024 15:55:32 +0100 Subject: [PATCH] Fix broken test --- golang/vaas/v3/pkg/vaas/vaas_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/golang/vaas/v3/pkg/vaas/vaas_test.go b/golang/vaas/v3/pkg/vaas/vaas_test.go index b97c0b1a..2af00d3c 100644 --- a/golang/vaas/v3/pkg/vaas/vaas_test.go +++ b/golang/vaas/v3/pkg/vaas/vaas_test.go @@ -388,8 +388,15 @@ func Test_ForStream_WitEicarFromUrl_ReturnsMalicious(t *testing.T) { func Test_ForStream_SendsUserAgent(t *testing.T) { eicarReader := strings.NewReader("X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*") server := getHttpTestServer(func(w http.ResponseWriter, r *http.Request) { - assert.Equal(t, r.Header.Get("User-Agent"), "Go/3.0.10-alpha") - defaultHttpHandler(t, w, r) + if strings.Contains(r.URL.Path, "/report") { + assert.Equal(t, r.Header.Get("User-Agent"), "Go/3.0.10-alpha") + defaultHttpHandler(t, w, r) + } else { + assert.Equal(t, r.Header.Get("User-Agent"), "Go/3.0.10-alpha") + w.WriteHeader(http.StatusCreated) + _, err := w.Write([]byte(`{"sha256": "12345"}`)) + assert.NoError(t, err) + } }) defer server.Close()