Move init of StaticFS and rename some vars

This commit is contained in:
2022-02-15 12:37:23 +00:00
parent 74a53954de
commit 2f45c415e0
4 changed files with 20 additions and 17 deletions

View File

@@ -32,8 +32,8 @@ func TestListTimezonesHandler(t *testing.T) {
CredentialsVerifier: &bcrypt.Verifier{},
}
rr := httptest.NewRecorder()
c, engine := gin.CreateTestContext(rr)
recorder := httptest.NewRecorder()
c, engine := gin.CreateTestContext(recorder)
h.LoadRoutes(engine)
t.Run("RegisterUser", func(t *testing.T) {
@@ -45,12 +45,12 @@ func TestListTimezonesHandler(t *testing.T) {
h.registerPost(c)
if rr.Code != http.StatusOK {
t.Errorf("handler returned wrong status code: got %v want %v", rr.Code, http.StatusOK)
if recorder.Code != http.StatusOK {
t.Errorf("handler returned wrong status code: got %v want %v", recorder.Code, http.StatusOK)
}
var response LoginResponse
err = json.NewDecoder(rr.Body).Decode(&response)
err = json.NewDecoder(recorder.Body).Decode(&response)
if err != nil {
t.Error(err.Error())
t.Error("Error registering")
@@ -62,12 +62,12 @@ func TestListTimezonesHandler(t *testing.T) {
t.Run("GetTransactions", func(t *testing.T) {
c.Request, err = http.NewRequest(http.MethodGet, "/account/accountid/transactions", nil)
if rr.Code != http.StatusOK {
t.Errorf("handler returned wrong status code: got %v want %v", rr.Code, http.StatusOK)
if recorder.Code != http.StatusOK {
t.Errorf("handler returned wrong status code: got %v want %v", recorder.Code, http.StatusOK)
}
var response TransactionsResponse
err = json.NewDecoder(rr.Body).Decode(&response)
err = json.NewDecoder(recorder.Body).Decode(&response)
if err != nil {
t.Error(err.Error())
t.Error("Error retreiving list of transactions.")