aboutsummaryrefslogtreecommitdiff
path: root/handler_test.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-12-01 20:42:21 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-12-01 20:42:21 +0100
commitb540f681b4cdf740f9b8d1e584fd2b107fc1b090 (patch)
tree26f2f9c3df8a563463c19621cb9f812978c90af3 /handler_test.go
parent12af3f2e8fad65534b83260967ea7463df6ca652 (diff)
started to clean-up instance
Things like opening files is better place in the server package. Any code that is difficult to test should also not be in the STFE package.
Diffstat (limited to 'handler_test.go')
-rw-r--r--handler_test.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/handler_test.go b/handler_test.go
index 689541b..3bcc702 100644
--- a/handler_test.go
+++ b/handler_test.go
@@ -43,17 +43,17 @@ func newTestHandler(t *testing.T, signer crypto.Signer) *testHandler {
}
}
-func (th *testHandler) getHandlers(t *testing.T) map[Endpoint]handler {
- return map[Endpoint]handler{
- EndpointGetSth: handler{instance: th.instance, handler: getSth, endpoint: EndpointGetSth, method: http.MethodGet},
- EndpointGetConsistencyProof: handler{instance: th.instance, handler: getConsistencyProof, endpoint: EndpointGetConsistencyProof, method: http.MethodGet},
- EndpointGetProofByHash: handler{instance: th.instance, handler: getProofByHash, endpoint: EndpointGetProofByHash, method: http.MethodGet},
- EndpointGetAnchors: handler{instance: th.instance, handler: getAnchors, endpoint: EndpointGetAnchors, method: http.MethodGet},
- EndpointGetEntries: handler{instance: th.instance, handler: getEntries, endpoint: EndpointGetEntries, method: http.MethodGet},
+func (th *testHandler) getHandlers(t *testing.T) map[Endpoint]Handler {
+ return map[Endpoint]Handler{
+ EndpointGetSth: Handler{instance: th.instance, handler: getSth, endpoint: EndpointGetSth, method: http.MethodGet},
+ EndpointGetConsistencyProof: Handler{instance: th.instance, handler: getConsistencyProof, endpoint: EndpointGetConsistencyProof, method: http.MethodGet},
+ EndpointGetProofByHash: Handler{instance: th.instance, handler: getProofByHash, endpoint: EndpointGetProofByHash, method: http.MethodGet},
+ EndpointGetAnchors: Handler{instance: th.instance, handler: getAnchors, endpoint: EndpointGetAnchors, method: http.MethodGet},
+ EndpointGetEntries: Handler{instance: th.instance, handler: getEntries, endpoint: EndpointGetEntries, method: http.MethodGet},
}
}
-func (th *testHandler) getHandler(t *testing.T, endpoint Endpoint) handler {
+func (th *testHandler) getHandler(t *testing.T, endpoint Endpoint) Handler {
handler, ok := th.getHandlers(t)[endpoint]
if !ok {
t.Fatalf("no such get endpoint: %s", endpoint)
@@ -61,13 +61,13 @@ func (th *testHandler) getHandler(t *testing.T, endpoint Endpoint) handler {
return handler
}
-func (th *testHandler) postHandlers(t *testing.T) map[Endpoint]handler {
- return map[Endpoint]handler{
- EndpointAddEntry: handler{instance: th.instance, handler: addEntry, endpoint: EndpointAddEntry, method: http.MethodPost},
+func (th *testHandler) postHandlers(t *testing.T) map[Endpoint]Handler {
+ return map[Endpoint]Handler{
+ EndpointAddEntry: Handler{instance: th.instance, handler: addEntry, endpoint: EndpointAddEntry, method: http.MethodPost},
}
}
-func (th *testHandler) postHandler(t *testing.T, endpoint Endpoint) handler {
+func (th *testHandler) postHandler(t *testing.T, endpoint Endpoint) Handler {
handler, ok := th.postHandlers(t)[endpoint]
if !ok {
t.Fatalf("no such post endpoint: %s", endpoint)