Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
rchincha committed Aug 14, 2024
1 parent 00c193d commit c427bd8
Show file tree
Hide file tree
Showing 27 changed files with 867 additions and 867 deletions.
16 changes: 8 additions & 8 deletions pkg/api/authn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestAllowedMethodsHeaderAPIKey(t *testing.T) {
ctrlManager.StartAndWait(port)
defer ctrlManager.StopServer()

resp, _ := resty.R().Options(baseURL + constants.APIKeyPath)
resp, _ := resty.New().R().Options(baseURL + constants.APIKeyPath)
So(resp, ShouldNotBeNil)
So(resp.Header().Get("Access-Control-Allow-Methods"), ShouldResemble, "GET,POST,DELETE,OPTIONS")
So(resp.Header().Get("Access-Control-Allow-Origin"), ShouldResemble, "*")
Expand Down Expand Up @@ -155,7 +155,7 @@ func TestAPIKeys(t *testing.T) {
So(err, ShouldBeNil)

Convey("API key retrieved with basic auth", func() {
resp, err := resty.R().
resp, err := resty.New().R().
SetBody(reqBody).
SetBasicAuth(username, password).
Post(baseURL + constants.APIKeyPath)
Expand All @@ -173,15 +173,15 @@ func TestAPIKeys(t *testing.T) {
email := user.Email
So(email, ShouldNotBeEmpty)

resp, err = resty.R().
resp, err = resty.New().R().
SetBasicAuth(username, apiKeyResponse.APIKey).
Get(baseURL + "/v2/_catalog")
So(err, ShouldBeNil)
So(resp, ShouldNotBeNil)
So(resp.StatusCode(), ShouldEqual, http.StatusOK)

// get API key list with basic auth
resp, err = resty.R().
resp, err = resty.New().R().
SetBasicAuth(username, password).
Get(baseURL + constants.APIKeyPath)
So(err, ShouldBeNil)
Expand All @@ -199,7 +199,7 @@ func TestAPIKeys(t *testing.T) {
So(apiKeyListResponse.APIKeys[0].UUID, ShouldEqual, apiKeyResponse.APIKeyDetails.UUID)

// add another one
resp, err = resty.R().
resp, err = resty.New().R().
SetBody(reqBody).
SetBasicAuth(username, password).
Post(baseURL + constants.APIKeyPath)
Expand All @@ -210,15 +210,15 @@ func TestAPIKeys(t *testing.T) {
err = json.Unmarshal(resp.Body(), &apiKeyResponse)
So(err, ShouldBeNil)

resp, err = resty.R().
resp, err = resty.New().R().
SetBasicAuth(username, apiKeyResponse.APIKey).
Get(baseURL + "/v2/_catalog")
So(err, ShouldBeNil)
So(resp, ShouldNotBeNil)
So(resp.StatusCode(), ShouldEqual, http.StatusOK)

// get API key list with api key auth
resp, err = resty.R().
resp, err = resty.New().R().
SetBasicAuth(username, apiKeyResponse.APIKey).
Get(baseURL + constants.APIKeyPath)
So(err, ShouldBeNil)
Expand Down Expand Up @@ -450,7 +450,7 @@ func TestAPIKeys(t *testing.T) {
So(resp.StatusCode(), ShouldEqual, http.StatusOK)

// get API key list
resp, err = resty.R().
resp, err = resty.New().R().
SetBasicAuth(email, apiKeyResponse.APIKey).
Get(baseURL + constants.APIKeyPath)
So(err, ShouldBeNil)
Expand Down
Loading

0 comments on commit c427bd8

Please sign in to comment.