Move init of StaticFS and rename some vars
This commit is contained in:
@@ -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.")
|
||||
|
Reference in New Issue
Block a user