本文整理汇总了Golang中github.com/cloudfoundry/cli/plugin/fakes.FakeCliConnection.AccessTokenCallCount方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeCliConnection.AccessTokenCallCount方法的具体用法?Golang FakeCliConnection.AccessTokenCallCount怎么用?Golang FakeCliConnection.AccessTokenCallCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/cli/plugin/fakes.FakeCliConnection
的用法示例。
在下文中一共展示了FakeCliConnection.AccessTokenCallCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
ghttp.VerifyFormKV("client_id", "ssh-oauth-client-id"),
ghttp.VerifyFormKV("grant_type", "authorization_code"),
ghttp.VerifyHeaderKV("authorization", "bearer client-bearer-token"),
ghttp.RespondWith(http.StatusFound, "", http.Header{
"Location": []string{"https://uaa.example.com/login?code=abc123"},
}),
))
})
It("forces the cli to refresh the access token used to acquire the access code", func() {
_, err := credFactory.AuthorizationCode()
Expect(err).NotTo(HaveOccurred())
Expect(fakeCliConnection.CliCommandWithoutTerminalOutputCallCount()).To(Equal(1))
Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)).To(ConsistOf("oauth-token"))
Expect(fakeCliConnection.AccessTokenCallCount()).To(Equal(1))
})
It("gets the access code from the token endpoint", func() {
code, err := credFactory.AuthorizationCode()
Expect(err).NotTo(HaveOccurred())
Expect(fakeUAA.ReceivedRequests()).To(HaveLen(1))
Expect(code).To(Equal("abc123"))
})
It("returns an error when the uaa certificate is not valid and certificate validation is enabled", func() {
fakeCliConnection.IsSSLDisabledReturns(false, nil)
_, err := credFactory.AuthorizationCode()
Expect(err).To(HaveOccurred())