Esempio n. 1
0
												Resource: "resource-name",
											},
										},
									},
								}

								fakeDB.GetResourceHistoryCursorReturns(history, true, nil)
							})

							Context("when the passed in id is 0", func() {
								It("uses the max id to pull history", func() {
									templateData, err := FetchTemplateData(fakeDB, false, "resource-name", 0, false)
									Expect(err).NotTo(HaveOccurred())

									Expect(fakeDB.GetResourceHistoryCursorCallCount()).To(Equal(1))
									resourceName, startingID, searchUpwards, numResults := fakeDB.GetResourceHistoryCursorArgsForCall(0)
									Expect(resourceName).To(Equal("resource-name"))
									Expect(startingID).To(Equal(MaxID))
									Expect(searchUpwards).To(BeFalse())
									Expect(numResults).To(Equal(100))
									Expect(templateData.PaginationData.HasPagination()).To(BeTrue())
								})
							})

							It("has the correct template data", func() {
								templateData, err := FetchTemplateData(fakeDB, authenticated, "resource-name", 0, false)
								Expect(err).NotTo(HaveOccurred())

								Expect(templateData.GroupStates).To(ConsistOf([]group.State{
									{
										Name:    "group-with-resource",