forked from concourse/concourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
go-concourse: split tests based on the client type used
- Loading branch information
Showing
4 changed files
with
57 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package internal_test | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/concourse/concourse/atc" | ||
. "github.com/concourse/concourse/go-concourse/concourse/internal" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"github.com/onsi/gomega/ghttp" | ||
"github.com/tedsuo/rata" | ||
) | ||
|
||
var _ = Describe("HTTPAgent Client", func() { | ||
var ( | ||
atcServer *ghttp.Server | ||
|
||
agent HTTPAgent | ||
|
||
tracing bool | ||
) | ||
|
||
BeforeEach(func() { | ||
atcServer = ghttp.NewServer() | ||
|
||
agent = NewHTTPAgent(atcServer.URL(), nil, tracing) | ||
}) | ||
|
||
Describe("#Send", func() { | ||
Describe("Different status codes", func() { | ||
Describe("403 response", func() { | ||
BeforeEach(func() { | ||
atcServer = ghttp.NewServer() | ||
|
||
agent = NewHTTPAgent(atcServer.URL(), nil, tracing) | ||
atcServer.AppendHandlers( | ||
ghttp.CombineHandlers( | ||
ghttp.VerifyRequest("DELETE", "/api/v1/teams/main/pipelines/foo"), | ||
ghttp.RespondWith(http.StatusForbidden, "problem"), | ||
), | ||
) | ||
}) | ||
It("returns back 403", func() { | ||
resp, err := agent.Send(Request{ | ||
RequestName: atc.DeletePipeline, | ||
Params: rata.Params{ | ||
"pipeline_name": "foo", | ||
"team_name": atc.DefaultTeamName, | ||
}, | ||
}) | ||
Expect(resp.StatusCode).To(Equal(http.StatusForbidden)) | ||
Expect(err).ToNot(HaveOccurred()) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.