Add basic /status endpoint
Also add test for this endpoint
This commit is contained in:
parent
5377e42e71
commit
4a0a91a1f1
3 changed files with 57 additions and 9 deletions
22
router_test.go
Normal file
22
router_test.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHandleStatus(t *testing.T) {
|
||||
request, _ := http.NewRequest(http.MethodGet, "/status", nil)
|
||||
response := httptest.NewRecorder()
|
||||
|
||||
HandleStatus(response, request)
|
||||
|
||||
var status RouterStatus
|
||||
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