Skip to content

Commit

Permalink
test updated to check status 400 for create user without role (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsinhaparseable authored Sep 4, 2024
1 parent 9ec751b commit 3e08497
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
14 changes: 1 addition & 13 deletions quest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,6 @@ func TestSmoke_AllUsersAPI(t *testing.T) {
AssertRole(t, NewGlob.QueryClient, "dummyrole", dummyRole)

CreateUser(t, NewGlob.QueryClient, "dummyuser")
AssignRolesToUser(t, NewGlob.QueryClient, "dummyuser", []string{"dummyrole"})
AssertUserRole(t, NewGlob.QueryClient, "dummyuser", "dummyrole", dummyRole)
RegenPassword(t, NewGlob.QueryClient, "dummyuser")
DeleteUser(t, NewGlob.QueryClient, "dummyuser")

CreateUserWithRole(t, NewGlob.QueryClient, "dummyuser", []string{"dummyrole"})
AssertUserRole(t, NewGlob.QueryClient, "dummyuser", "dummyrole", dummyRole)
RegenPassword(t, NewGlob.QueryClient, "dummyuser")
Expand All @@ -431,14 +426,7 @@ func TestSmoke_NewUserNoRole(t *testing.T) {
SetDefaultRole(t, NewGlob.QueryClient, "dummyrole")
AssertDefaultRole(t, NewGlob.QueryClient, "\"dummyrole\"")

password := CreateUser(t, NewGlob.QueryClient, "dummyuser")
userClient := NewGlob.QueryClient
userClient.Username = "dummyuser"
userClient.Password = password

PutSingleEventExpectErr(t, userClient, NewGlob.Stream)

DeleteUser(t, NewGlob.QueryClient, "dummyuser")
CreateUser(t, NewGlob.QueryClient, "dummyuser")
DeleteStream(t, NewGlob.QueryClient, NewGlob.Stream)

}
Expand Down
2 changes: 1 addition & 1 deletion test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ func CreateUser(t *testing.T, client HTTPClient, user string) string {
response, err := client.Do(req)
require.NoErrorf(t, err, "Request failed: %s", err)
body := readAsString(response.Body)
require.Equalf(t, 200, response.StatusCode, "Server returned http code: %s and response: %s", response.Status, body)
require.Equalf(t, 400, response.StatusCode, "Server returned http code: %s resp %s", response.Status, readAsString(response.Body))
return body
}

Expand Down

0 comments on commit 3e08497

Please sign in to comment.