Skip to content

Commit

Permalink
go-concourse: http agent: add the removed test back to http agent tes…
Browse files Browse the repository at this point in the history
…t suite

Signed-off-by: aliculPix4D <[email protected]>
  • Loading branch information
aliculPix4D committed Oct 3, 2024
1 parent 52fbf91 commit 7bc2c11
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions go-concourse/concourse/internal/http_agent_test.go
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())
})
})
})
})
})

0 comments on commit 7bc2c11

Please sign in to comment.