Exemplo n.º 1
0
				fakeBBS.DesiredLRPsByDomainReturns([]models.DesiredLRP{
					{
						ProcessGuid: "process-guid-2",
						Domain:      "domain-2",
						Action: &models.RunAction{
							User: "******",
							Path: "the-path",
						},
					},
				}, nil)
			})

			It("call the BBS to retrieve the desired LRP", func() {
				handler.GetAll(responseRecorder, newTestRequest(""))
				Expect(fakeBBS.DesiredLRPsCallCount()).To(Equal(1))
			})

			It("responds with 200 Status OK", func() {
				handler.GetAll(responseRecorder, newTestRequest(""))
				Expect(responseRecorder.Code).To(Equal(http.StatusOK))
			})

			Context("when a domain query param is provided", func() {
				It("returns all desired lrp responses for the domain", func() {
					request, err := http.NewRequest("", "http://example.com?domain=domain-2", nil)
					Expect(err).NotTo(HaveOccurred())

					handler.GetAll(responseRecorder, request)

					response := []receptor.DesiredLRPResponse{}