Adds last currentUser route tests
All checks were successful
gitea-deepak/gogmagog/pipeline/head This commit looks good
All checks were successful
gitea-deepak/gogmagog/pipeline/head This commit looks good
This commit is contained in:
parent
63a9e2ff58
commit
c9675b1573
@ -131,3 +131,28 @@ func TestErrorUserContextNoUserID(t *testing.T) {
|
|||||||
assert.Equal(http.StatusInternalServerError, status)
|
assert.Equal(http.StatusInternalServerError, status)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSingleUserErrorWriter(t *testing.T) {
|
||||||
|
// set up
|
||||||
|
assert := assert.New(t)
|
||||||
|
m := getEmptyModel()
|
||||||
|
|
||||||
|
idToUse := 1
|
||||||
|
username := "testing_username"
|
||||||
|
displayName := "testing_name"
|
||||||
|
password := "pass"
|
||||||
|
m.CreateUser(&models.CreateUserRequest{Username: username, DisplayName: displayName, Password: password})
|
||||||
|
|
||||||
|
router := routes.NewCurrentUserRouter(m)
|
||||||
|
req, _ := http.NewRequestWithContext(tokens.GetContextForUserValues(idToUse, username), "GET", "/", nil)
|
||||||
|
|
||||||
|
rr := NewBadWriter()
|
||||||
|
|
||||||
|
// function under test
|
||||||
|
router.ServeHTTP(rr, req)
|
||||||
|
|
||||||
|
// check results
|
||||||
|
status := rr.Code
|
||||||
|
assert.Equal(http.StatusInternalServerError, status)
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user