Exemplo n.º 1
0
				models.NewCellPresence("cell-id-0", "1.2.3.4", "the-zone", capacity),
				models.NewCellPresence("cell-id-1", "4.5.6.7", "the-zone", capacity),
			}
		})

		JustBeforeEach(func() {
			handler.GetAll(responseRecorder, newTestRequest(""))
		})

		Context("when reading Cells from BBS succeeds", func() {
			BeforeEach(func() {
				fakeBBS.CellsReturns(cellPresences, nil)
			})

			It("call the BBS to retrieve the actual LRPs", func() {
				Expect(fakeBBS.CellsCallCount()).To(Equal(1))
			})

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

			It("returns a list of cell presence responses", func() {
				response := []receptor.CellResponse{}
				err := json.Unmarshal(responseRecorder.Body.Bytes(), &response)
				Expect(err).NotTo(HaveOccurred())

				Expect(response).To(HaveLen(2))
				for _, cellPresence := range cellPresences {
					Expect(response).To(ContainElement(serialization.CellPresenceToCellResponse(cellPresence)))
				}