Пример #1
0
		It("gets the login prompts", func() {
			Expect(prompts).To(Equal(map[string]configuration.AuthPrompt{
				"username": configuration.AuthPrompt{
					DisplayName: "Email",
					Type:        configuration.AuthPromptTypeText,
				},
				"pin": configuration.AuthPrompt{
					DisplayName: "PIN Number",
					Type:        configuration.AuthPromptTypePassword,
				},
			}))
		})

		It("saves the UAA server to the config", func() {
			Expect(config.UaaEndpoint()).To(Equal("https://uaa.run.pivotal.io"))
		})
	})

	It("returns a failure response when the login info API fails", func() {
		testServer, handler, config = setupAuthDependencies(loginInfoFailureRequest)
		auth := NewUAAAuthenticationRepository(gateway, config)

		prompts, apiErr := auth.GetLoginPromptsAndSaveUAAServerURL()
		Expect(handler).To(testnet.HaveAllRequestsCalled())
		Expect(apiErr).To(HaveOccurred())
		Expect(prompts).To(BeEmpty())
	})
})

var authHeaders = http.Header{
Пример #2
0
			It("gets the login prompts", func() {
				Expect(prompts).To(Equal(map[string]configuration.AuthPrompt{
					"username": configuration.AuthPrompt{
						DisplayName: "Email",
						Type:        configuration.AuthPromptTypeText,
					},
					"pin": configuration.AuthPrompt{
						DisplayName: "PIN Number",
						Type:        configuration.AuthPromptTypePassword,
					},
				}))
			})

			It("saves the UAA server to the config", func() {
				Expect(config.UaaEndpoint()).To(Equal("https://uaa.run.pivotal.io"))
			})
		})

		Describe("when the login info API fails", func() {
			BeforeEach(func() {
				setupTestServer(loginServerLoginFailureRequest)
			})

			It("returns a failure response when the login info API fails", func() {
				Expect(handler).To(testnet.HaveAllRequestsCalled())
				Expect(apiErr).To(HaveOccurred())
				Expect(prompts).To(BeEmpty())
			})
		})