Skip to content

Commit

Permalink
fix whoami test
Browse files Browse the repository at this point in the history
  • Loading branch information
ProkopRandacek committed Mar 22, 2024
1 parent d0f9102 commit e9b7590
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ func TestLogin(t *testing.T) {
expectFail(t, hitPost(t, srv, "/api/v1/login", LoginRequest{Username: "marek", Password: HashPassword("catboy123")}), http.StatusForbidden, "wrong name or password")
res := hitPost(t, srv, "/api/v1/login", LoginRequest{Username: "prokop", Password: HashPassword("catboy123")})
expectStatusCode(t, res, http.StatusOK)
expectBody(t, res, "{\"ok\":true,\"data\":{\"token\":\"Ff-DAwEBCUZ1bGxUb2tlbgH_hAAAAA==\"}}\n")
// FIXME check that ok is true and that there is a token but not what token
expectBody(t, res, "{\"ok\":true,\"data\":{\"token\":\"Kv-DAwEBCUZ1bGxUb2tlbgH_hAABAgEERGF0YQH_gAABBFNpZ24BCgAAAD9_AwEBDFRva2VuUGF5bG9hZAH_gAABAwEIVXNlcm5hbWUBDAABCVRpbWVzdGFtcAH_ggABBU5vbmNlAQQAAAAQ_4EFAQEEVGltZQH_ggAAAGr_hAEBBnByb2tvcAEPAQAAAA7dj0O2MGMlnQA8AfgjH9FHtrN6pgABQEqtN2qG2nysISitEySEoNgyqqQvE2HkN7nFzZ8f88q5xKkvFSkrufHesbopZeU14sEZK1Aa1QaWmlw7wmhdWAQA\"}}\n")
}

func loginHelper(t *testing.T, srv http.Handler, username, pwd string) string {
Expand Down Expand Up @@ -143,5 +144,5 @@ func TestWhoamiWorks(t *testing.T) {
res := w.Result()

expectStatusCode(t, res, http.StatusOK)
expectBody(t, res, "")
expectBody(t, res, "{\"ok\":true,\"data\":{\"name\":\"matúš\"}}\n")
}

0 comments on commit e9b7590

Please sign in to comment.