Refactor into server object to handle registered accounts
This commit is contained in:
parent
eccb726f74
commit
93decc027b
13 changed files with 304 additions and 128 deletions
25
pkg/server/router_test.go
Normal file
25
pkg/server/router_test.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHandleStatus(t *testing.T) {
|
||||
request, _ := http.NewRequest(http.MethodGet, "/status", nil)
|
||||
response := httptest.NewRecorder()
|
||||
|
||||
s := NewServer(8080)
|
||||
s.Initialise()
|
||||
|
||||
s.HandleStatus(response, request)
|
||||
|
||||
var status StatusResponse
|
||||
json.NewDecoder(response.Body).Decode(&status)
|
||||
|
||||
if status.Ready != true {
|
||||
t.Errorf("got false for /status")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue