mirror of
https://github.com/OpenMaxIO/openmaxio-object-browser
synced 2026-07-01 07:41:18 -07:00
Correcting response on invalid login attempt (#2216)
Verifying detailed message error from bad login in SSO Test
This commit is contained in:
committed by
GitHub
parent
ea0cac2a92
commit
16fd5470db
@@ -21,6 +21,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -29,6 +30,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
|
||||
"github.com/go-openapi/loads"
|
||||
consoleoauth2 "github.com/minio/console/pkg/auth/idp/oauth2"
|
||||
"github.com/minio/console/restapi"
|
||||
@@ -254,5 +257,15 @@ func TestBadLogin(t *testing.T) {
|
||||
fmt.Println(response)
|
||||
fmt.Println(err)
|
||||
expectedError := response.Status
|
||||
assert.Equal("500 Internal Server Error", expectedError)
|
||||
assert.Equal("400 Bad Request", expectedError)
|
||||
bodyBytes, _ := ioutil.ReadAll(response.Body)
|
||||
result2 := models.Error{}
|
||||
err = json.Unmarshal(bodyBytes, &result2)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
assert.Nil(err)
|
||||
}
|
||||
detailedMessage := *result2.DetailedMessage
|
||||
fmt.Println(detailedMessage)
|
||||
assert.Equal("expected 'code' response type - got [], login not allowed", detailedMessage)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user