fakeDesiredLRPDB.DesiredLRPSchedulingInfosReturns(schedulingInfos, nil) }) It("returns a list of desired lrp groups", func() { Expect(responseRecorder.Code).To(Equal(http.StatusOK)) response := models.DesiredLRPSchedulingInfosResponse{} err := response.Unmarshal(responseRecorder.Body.Bytes()) Expect(err).NotTo(HaveOccurred()) Expect(response.Error).To(BeNil()) Expect(response.DesiredLrpSchedulingInfos).To(Equal(schedulingInfos)) }) Context("and no filter is provided", func() { It("call the DB with no filters to retrieve the desired lrps", func() { Expect(fakeDesiredLRPDB.DesiredLRPSchedulingInfosCallCount()).To(Equal(1)) _, filter := fakeDesiredLRPDB.DesiredLRPSchedulingInfosArgsForCall(0) Expect(filter).To(Equal(models.DesiredLRPFilter{})) }) }) Context("and filtering by domain", func() { BeforeEach(func() { requestBody = &models.DesiredLRPsRequest{Domain: "domain-1"} }) It("call the DB with the domain filter to retrieve the desired lrps", func() { Expect(fakeDesiredLRPDB.DesiredLRPSchedulingInfosCallCount()).To(Equal(1)) _, filter := fakeDesiredLRPDB.DesiredLRPSchedulingInfosArgsForCall(0) Expect(filter.Domain).To(Equal("domain-1")) })