test

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertMethod

func AssertMethod(t *testing.T, expectedMethod string, req *http.Request)

AssertMethod test that the Request has the expected http method

func AssertReqJSON

func AssertReqJSON(t *testing.T, expected map[string]interface{}, req *http.Request)

AssertReqJSON tests that the Request has the expected key values pairs json encoded in its Body

func CreateAtlasProject added in v0.0.7

func CreateAtlasProject(projectName string, groupID string, namespace string, organizationID string) *knappekv1alpha1.MongoDBAtlasProject

CreateAtlasProject returns a standard atlas project

func Server

func Server() (*http.Client, *http.ServeMux, *httptest.Server)

Server returns an http Client, ServeMux, and Server. The client proxies requests to the server and handlers can be registered on the mux to handle requests. The caller must close the test server.

Types

type RewriteTransport

type RewriteTransport struct {
	Transport http.RoundTripper
}

RewriteTransport rewrites https requests to http to avoid TLS cert issues during testing.

func (*RewriteTransport) RoundTrip

func (t *RewriteTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip rewrites the request scheme to http and calls through to the composed RoundTripper or if it is nil, to the http.DefaultTransport.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL