mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
Modifies tests for accepting {"id":$userID}
response
This commit is contained in:
parent
8ce554b6d7
commit
426b834ea5
1 changed files with 8 additions and 6 deletions
|
@ -46,18 +46,20 @@ func TestUserEndpoints(t *testing.T) {
|
|||
Mail: common.UserA.Mail,
|
||||
Role: common.UserA.Role,
|
||||
}
|
||||
// TODO: For now the response from this endpoint has the form
|
||||
// {"user":$Username}. Make sure that this should be the usual
|
||||
// {"user":$User{}} response.
|
||||
// Get the number of alreday existing users so to know the expected
|
||||
// id of the new user
|
||||
maxid, err := common.LengthOfResponse(router, token,
|
||||
"/api/users", "GET", nil)
|
||||
assert.NoError(t, err)
|
||||
err = common.NewTestEndpoint(router, token,
|
||||
"/api/users", "POST", common.KeyModels{"user": newUser},
|
||||
200, common.KeyModels{"user": newUser.Username})
|
||||
200, common.KeyModels{"id": maxid + 1})
|
||||
assert.NoError(t, err)
|
||||
|
||||
// test PUT user/1 $modifiedUser
|
||||
modifiedUser := common.Request{Role: "Admin"}
|
||||
err = common.NewTestEndpoint(router, token,
|
||||
"/api/users/1", "PUT", common.KeyModels{"user": modifiedUser},
|
||||
200, common.KeyModels{"user": modifiedUser.Username})
|
||||
"/api/users/2", "PUT", common.KeyModels{"user": modifiedUser},
|
||||
200, common.KeyModels{"id": 2})
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue