mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
Extends test for GET /users auth as role=User
This commit is contained in:
parent
f4a15e914e
commit
67e4043071
1 changed files with 14 additions and 0 deletions
|
@ -106,6 +106,20 @@ func TestGetAllUsers(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, finalNumber, initialNumber+1)
|
||||
|
||||
// Authenticate as the added user
|
||||
token, err = common.NewAuthenticateForTest(router,
|
||||
"/api/authenticate", "POST", common.Request{
|
||||
Username: newUser.Username,
|
||||
Password: newUser.Password,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Try to get all the users (NOT ALLOWED)
|
||||
code, resp, err = common.NewTestEndpoint(router, token,
|
||||
"/api/users", "POST", common.KeyModels{"user": newUser})
|
||||
assert.NoError(t, err)
|
||||
assert.Equalf(t, 422, code, "Response body: \n%v\n", resp)
|
||||
}
|
||||
|
||||
func TestModifyAddedUserAsUser(t *testing.T) {
|
||||
|
|
Loading…
Add table
Reference in a new issue