Documentation ¶
Index ¶
- Constants
- func CheckApiResponse(status api.Response, code string) error
- func CheckRedirect(url string, resp *http.Response) error
- func NewConfig() *config.AuthPlzConfig
- func ParseAndCheckAPIResponse(resp *http.Response, code string) error
- func ParseJson(resp *http.Response, inst interface{}) error
- type Client
- func (tc *Client) Get(path string, statusCode int) (*http.Response, error)
- func (tc *Client) GetAPIResponse(path string, statusCode int, code string) error
- func (tc *Client) GetJSON(path string, statusCode int, inst interface{}) error
- func (tc *Client) GetJSONWithParams(path string, statusCode int, v url.Values, inst interface{}) error
- func (tc *Client) GetWithParams(path string, statusCode int, v url.Values) (*http.Response, error)
- func (tc *Client) PostForm(path string, statusCode int, v url.Values) (*http.Response, error)
- func (tc *Client) PostJSON(path string, statusCode int, requestInst interface{}) (*http.Response, error)
- type MockEventEmitter
- type TestServer
Constants ¶
View Source
const ( FakeEmail = "test@abc.com" FakePass = "V3vRyT!$5qNHt9H1" NewPass = "*$M^kiD2Nhs8OpkR" FakeName = "user.sdfsfdF" )
Variables ¶
This section is empty.
Functions ¶
func CheckApiResponse ¶
CheckApiResponse checks an API resonse matches the provded message
func CheckRedirect ¶
CheckRedirect checks that a given redirect is correct
Types ¶
type Client ¶
Client instance Handles cookies as well as API base addresses and provides convenience wrappers to simplify testing
func NewClientFromHttp ¶
NewClientFromHttp Create a new Client instance using the provided http.Client Useful for OAuth clients
func (*Client) GetAPIResponse ¶
func (*Client) GetJSONWithParams ¶
func (*Client) GetWithParams ¶
GetWithParamsGet wraps client.Get with query parameters and status code checks
type MockEventEmitter ¶
type MockEventEmitter struct {
Event *events.AuthPlzEvent
}
func (*MockEventEmitter) SendEvent ¶
func (m *MockEventEmitter) SendEvent(e interface{})
type TestServer ¶
type TestServer struct { Router *web.Router DataStore *datastore.DataStore TokenControl *token.TokenController EventEmitter *MockEventEmitter Config *config.AuthPlzConfig }
func NewTestServer ¶
func NewTestServer() (*TestServer, error)
func (*TestServer) Address ¶
func (ts *TestServer) Address() string
func (*TestServer) Run ¶
func (ts *TestServer) Run()
Click to show internal directories.
Click to hide internal directories.