本文整理匯總了Golang中github.com/cloudfoundry-incubator/uaa-token-fetcher/fakes.FakeTokenFetcher.FetchTokenStub方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeTokenFetcher.FetchTokenStub方法的具體用法?Golang FakeTokenFetcher.FetchTokenStub怎麽用?Golang FakeTokenFetcher.FetchTokenStub使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry-incubator/uaa-token-fetcher/fakes.FakeTokenFetcher
的用法示例。
在下文中一共展示了FakeTokenFetcher.FetchTokenStub方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
fetcher.StartFetchCycle()
Eventually(func() int {
return len(sink.Records())
}).Should(BeNumerically(">=", 1))
Expect(sink.Records()).ToNot(BeNil())
Expect(sink.Records()[0].Message).To(Equal("Unauthorized"))
})
})
Describe(".StartEventCycle", func() {
Context("when fetching the auth token fails", func() {
It("logs the failure and tries again", func() {
tokenFetcher.FetchTokenStub = func() (*token_fetcher.Token, error) {
return nil, errors.New("failed to get the token")
}
fetcher.StartEventCycle()
Eventually(func() string {
if len(sink.Records()) > 0 {
return sink.Records()[0].Message
} else {
return ""
}
}).Should(Equal("failed to get the token"))
Eventually(tokenFetcher.FetchTokenCallCount).Should(BeNumerically(">=", 2))
})
})
Context("and the event source successfully subscribes", func() {