本文整理汇总了Golang中github.com/cloudfoundry-incubator/receptor/fake_receptor.FakeClient.GetTaskReturns方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeClient.GetTaskReturns方法的具体用法?Golang FakeClient.GetTaskReturns怎么用?Golang FakeClient.GetTaskReturns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-incubator/receptor/fake_receptor.FakeClient
的用法示例。
在下文中一共展示了FakeClient.GetTaskReturns方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
BeforeEach(func() {
fakeReceptorClient = &fake_receptor.FakeClient{}
taskExaminer = task_examiner.New(fakeReceptorClient)
})
Describe("TaskStatus", func() {
BeforeEach(func() {
getTaskResponse := receptor.TaskResponse{
TaskGuid: "boop",
State: receptor.TaskStateCompleted,
CellID: "cell-01",
Failed: false,
FailureReason: "",
Result: "some-result",
}
fakeReceptorClient.GetTaskReturns(getTaskResponse, nil)
})
It("returns a task status", func() {
taskInfo, err := taskExaminer.TaskStatus("boop")
Expect(err).ToNot(HaveOccurred())
Expect(taskInfo.TaskGuid).To(Equal("boop"))
Expect(taskInfo.State).To(Equal(receptor.TaskStateCompleted))
Expect(taskInfo.CellID).To(Equal("cell-01"))
Expect(taskInfo.Failed).To(BeFalse())
Expect(taskInfo.FailureReason).To(BeEmpty())
Expect(taskInfo.Result).To(Equal("some-result"))
Expect(fakeReceptorClient.GetTaskCallCount()).To(Equal(1))
Expect(fakeReceptorClient.GetTaskArgsForCall(0)).To(Equal("boop"))
})