aboutsummaryrefslogtreecommitdiff
path: root/handler_test.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-11 12:14:58 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-11 12:14:58 +0100
commit1ed855eb51283be1969fa337bececeecd6c5e344 (patch)
tree96e58b6709aaddf63bf73ff73a1e41fe448a35b3 /handler_test.go
parent333f5a95ef037220e5c40df85599bb00f86a42f1 (diff)
removed code snippets that we don't need for now
Diffstat (limited to 'handler_test.go')
-rw-r--r--handler_test.go33
1 files changed, 1 insertions, 32 deletions
diff --git a/handler_test.go b/handler_test.go
index a98c9d6..c8cbaca 100644
--- a/handler_test.go
+++ b/handler_test.go
@@ -3,7 +3,6 @@ package stfe
import (
"crypto"
"errors"
- "fmt"
"strings"
"testing"
"time"
@@ -14,12 +13,9 @@ import (
"github.com/golang/mock/gomock"
"github.com/google/certificate-transparency-go/trillian/mockclient"
- "github.com/google/go-cmp/cmp"
"github.com/google/trillian"
"github.com/system-transparency/stfe/server/testdata"
"github.com/system-transparency/stfe/x509util"
-
- "google.golang.org/protobuf/proto"
)
type testHandler struct {
@@ -149,11 +145,6 @@ func TestGetSth(t *testing.T) {
th := newTestHandler(t, nil)
defer th.mockCtrl.Finish()
- treq := &trillian.GetLatestSignedLogRootRequest{
- LogId: th.instance.LogParameters.TreeId,
- }
- th.client.EXPECT().GetLatestSignedLogRoot(deadlineMatcher{}, compareMatcher{treq}).Return(table.trsp, table.terr)
-
url := "http://example.com" + th.instance.LogParameters.Prefix + "/get-sth"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
@@ -161,6 +152,7 @@ func TestGetSth(t *testing.T) {
}
w := httptest.NewRecorder()
+ th.client.EXPECT().GetLatestSignedLogRoot(gomock.Any(), gomock.Any()).Return(table.trsp, table.terr)
th.getHandler(t, "get-sth").ServeHTTP(w, req)
if w.Code != table.wantCode {
t.Errorf("GET(%s)=%d, want http status code %d", url, w.Code, table.wantCode)
@@ -177,26 +169,3 @@ func TestGetSth(t *testing.T) {
}()
}
}
-
-type deadlineMatcher struct {
-}
-
-func (dm deadlineMatcher) Matches(x interface{}) bool {
- return true // TODO: deadlineMatcher.Matches
-}
-
-func (dm deadlineMatcher) String() string {
- return fmt.Sprintf("deadline is: TODO")
-}
-
-type compareMatcher struct {
- want interface{}
-}
-
-func (cm compareMatcher) Matches(got interface{}) bool {
- return cmp.Equal(got, cm.want, cmp.Comparer(proto.Equal))
-}
-
-func (cm compareMatcher) String() string {
- return fmt.Sprintf("equals: TODO")
-}