<commit_before>package concourse_test

import (
	"net/http"

	"github.com/concourse/atc"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/ghttp"
)

var _ = Describe("ATC Handler Containers", func() {
	Describe("ListContainers", func() {
		Context("when passed an empty specification list", func() {
			var expectedContainers []atc.Container

			BeforeEach(func() {
				expectedURL := "/api/v1/containers"

				expectedContainers = []atc.Container{
					{
						ID:           "myid-1",
						PipelineName: "mypipeline-1",
					},
					{
						ID:           "myid-2",
						PipelineName: "mypipeline-2",
					},
				}

				atcServer.AppendHandlers(
					ghttp.CombineHandlers(
						ghttp.VerifyRequest("GET", expectedURL),
						ghttp.RespondWithJSONEncoded(http.StatusOK, expectedContainers),
					),
				)
			})

			It("returns all the containers", func() {
				containers, err := client.ListContainers(map[string]string{})
				Expect(err).NotTo(HaveOccurred())
				Expect(containers).To(Equal(expectedContainers))
			})
		})

		Context("when passed a nonempty specification list", func() {
			var (
				expectedContainers []atc.Container
				expectedQueryList  map[string]string
			)

			BeforeEach(func() {
				expectedURL := "/api/v1/containers"
				expectedQueryList = map[string]string{
					"query1": "value1",
				}

				expectedContainers = []atc.Container{
					{
						ID:           "myid-1",
						PipelineName: "mypipeline-1",
					},
				}

				atcServer.AppendHandlers(
					ghttp.CombineHandlers(
						ghttp.VerifyRequest("GET", expectedURL, "query1=value1"),
						ghttp.RespondWithJSONEncoded(http.StatusOK, expectedContainers),
					),
				)
			})

			It("returns the specified containers", func() {
				containers, err := client.ListContainers(expectedQueryList)
				Expect(err).NotTo(HaveOccurred())
				Expect(containers).To(Equal(expectedContainers))
			})
		})
	})
})<commit_msg>Add working directory field to containers test<commit_after>package concourse_test

import (
	"net/http"

	"github.com/concourse/atc"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/ghttp"
)

var _ = Describe("ATC Handler Containers", func() {
	Describe("ListContainers", func() {
		Context("when passed an empty specification list", func() {
			var expectedContainers []atc.Container

			BeforeEach(func() {
				expectedURL := "/api/v1/containers"

				expectedContainers = []atc.Container{
					{
						ID:               "myid-1",
						PipelineName:     "mypipeline-1",
						WorkingDirectory: "/tmp/build/some-guid",
					},
					{
						ID:               "myid-2",
						PipelineName:     "mypipeline-2",
						WorkingDirectory: "/tmp/build/some-other-guid",
					},
				}

				atcServer.AppendHandlers(
					ghttp.CombineHandlers(
						ghttp.VerifyRequest("GET", expectedURL),
						ghttp.RespondWithJSONEncoded(http.StatusOK, expectedContainers),
					),
				)
			})

			It("returns all the containers", func() {
				containers, err := client.ListContainers(map[string]string{})
				Expect(err).NotTo(HaveOccurred())
				Expect(containers).To(Equal(expectedContainers))
			})
		})

		Context("when passed a nonempty specification list", func() {
			var (
				expectedContainers []atc.Container
				expectedQueryList  map[string]string
			)

			BeforeEach(func() {
				expectedURL := "/api/v1/containers"
				expectedQueryList = map[string]string{
					"query1": "value1",
				}

				expectedContainers = []atc.Container{
					{
						ID:               "myid-1",
						PipelineName:     "mypipeline-1",
						WorkingDirectory: "/tmp/build/some-guid",
					},
				}

				atcServer.AppendHandlers(
					ghttp.CombineHandlers(
						ghttp.VerifyRequest("GET", expectedURL, "query1=value1"),
						ghttp.RespondWithJSONEncoded(http.StatusOK, expectedContainers),
					),
				)
			})

			It("returns the specified containers", func() {
				containers, err := client.ListContainers(expectedQueryList)
				Expect(err).NotTo(HaveOccurred())
				Expect(containers).To(Equal(expectedContainers))
			})
		})
	})
})
{'fraction_non_alphanumeric': 0.13942661112472432, 'fraction_numerical': 0.0058809115412889, 'mean_word_length': 3.017716535433071, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5601883', 'n_tokens_mistral': 1726, 'n_tokens_neox': 1319, 'n_words': 204}