@@ -16,14 +16,15 @@ limitations under the License.
1616package gw
1717
1818import (
19- "github.com/prometheus/client_golang/prometheus"
2019 "net/http"
2120 "net/http/httptest"
2221 "os"
2322 "testing"
2423
24+ "github.com/prometheus/client_golang/prometheus"
25+
26+ "github.com/codenotary/immudb/embedded/logger"
2527 "github.com/codenotary/immudb/pkg/api/schema"
26- "github.com/codenotary/immudb/pkg/logger"
2728 "github.com/codenotary/immugw/pkg/json"
2829 "github.com/stretchr/testify/require"
2930)
@@ -64,27 +65,27 @@ func TestLastAuditHandler(t *testing.T) {
6465}
6566
6667/*
67- func TestLastAuditHandlerJSONError(t *testing.T) {
68- req, err := http.NewRequest("GET", "/lastaudit", nil)
69- require.NoError(t, err)
70- rr := httptest.NewRecorder()
71-
72- ms := metricServer{
73- mc: &MetricsCollection{},
74- srv: nil,
68+ func TestLastAuditHandlerJSONError(t *testing.T) {
69+ req, err := http.NewRequest("GET", "/lastaudit", nil)
70+ require.NoError(t, err)
71+ rr := httptest.NewRecorder()
72+
73+ ms := metricServer{
74+ mc: &MetricsCollection{},
75+ srv: nil,
76+ }
77+
78+ handlerWithJSONErr := http.HandlerFunc(ms.lastAuditHandler(newTestJSONWithMarshalErr()))
79+ handlerWithJSONErr.ServeHTTP(rr, req)
80+ require.Equal(
81+ t,
82+ http.StatusInternalServerError,
83+ rr.Code,
84+ "lastAuditHandler returned wrong status code: expected %v, actual %v",
85+ http.StatusInternalServerError,
86+ rr.Code)
87+ require.Contains(t, rr.Body.String(), "JSON marshal error")
7588 }
76-
77- handlerWithJSONErr := http.HandlerFunc(ms.lastAuditHandler(newTestJSONWithMarshalErr()))
78- handlerWithJSONErr.ServeHTTP(rr, req)
79- require.Equal(
80- t,
81- http.StatusInternalServerError,
82- rr.Code,
83- "lastAuditHandler returned wrong status code: expected %v, actual %v",
84- http.StatusInternalServerError,
85- rr.Code)
86- require.Contains(t, rr.Body.String(), "JSON marshal error")
87- }
8889*/
8990func TestUpdateAuditResult (t * testing.T ) {
9091 reg := prometheus .NewRegistry ()
0 commit comments