コード例 #1
0
func testSetupFakeServer() (client *OIDCClient, server *mocks.Server) {
	server = mocks.NewTlsTestServer()

	options := &OIDCClientOptions{
		IgnoreCertificate: true,
	}

	client = NewOIDCClient(server.HttpServer.URL, options, nil)
	return
}
コード例 #2
0
)

var _ = Describe("Auth", func() {
	var (
		server     *mocks.Server
		authServer *mocks.Server
		client     *Client
	)

	BeforeEach(func() {
		if isIntegrationTest() {
			Skip("Skipping auth test as we don't know if auth is on or off.")
		}

		server, client = testSetup()
		authServer = mocks.NewTlsTestServer()
	})

	AfterEach(func() {
		server.Close()
		authServer.Close()
	})

	Describe("GetAuth", func() {
		It("returns auth info", func() {
			expected := createMockAuthInfo(nil)
			server.SetResponseJson(200, expected)

			info, err := client.Auth.Get()
			fmt.Fprintf(GinkgoWriter, "Got auth info: %+v\n", info)
			Expect(err).Should(BeNil())