test

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizeOauth2ProviderBadRequest

func AuthorizeOauth2ProviderBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.Oauth2ProviderController, clientID string, redirectURI *string, responseType string, scope *string, state *string) (http.ResponseWriter, *app.OAuth2ErrorMedia)

AuthorizeOauth2ProviderBadRequest runs the method Authorize of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.

func AuthorizeOauth2ProviderFound

func AuthorizeOauth2ProviderFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.Oauth2ProviderController, clientID string, redirectURI *string, responseType string, scope *string, state *string) http.ResponseWriter

AuthorizeOauth2ProviderFound runs the method Authorize of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers. If ctx is nil then context.Background() is used. If service is nil then a default service is created.

func ConfirmAuthorizationAuthUIBadRequest

func ConfirmAuthorizationAuthUIBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.AuthUIController, confirmed *bool) (http.ResponseWriter, error)

ConfirmAuthorizationAuthUIBadRequest runs the method ConfirmAuthorization of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.

func ConfirmAuthorizationAuthUIInternalServerError

func ConfirmAuthorizationAuthUIInternalServerError(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.AuthUIController, confirmed *bool) (http.ResponseWriter, error)

ConfirmAuthorizationAuthUIInternalServerError runs the method ConfirmAuthorization of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.

func GetTokenOauth2ProviderBadRequest

func GetTokenOauth2ProviderBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.Oauth2ProviderController, payload *app.TokenPayload) (http.ResponseWriter, *goaoauth2app.OAuth2ErrorMedia)

GetTokenOauth2ProviderBadRequest runs the method GetToken of the given controller with the given parameters and payload. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.

func GetTokenOauth2ProviderOK

func GetTokenOauth2ProviderOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.Oauth2ProviderController, payload *app.TokenPayload) (http.ResponseWriter, *goaoauth2app.TokenMedia)

GetTokenOauth2ProviderOK runs the method GetToken of the given controller with the given parameters and payload. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.

func NewMockOAuth2Provider

func NewMockOAuth2Provider(clients []*oauth2.Client) *oauth2.AuthProvider

func PromptAuthorizationAuthUIBadRequest

func PromptAuthorizationAuthUIBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.AuthUIController) (http.ResponseWriter, error)

PromptAuthorizationAuthUIBadRequest runs the method PromptAuthorization of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.

func PromptAuthorizationAuthUIInternalServerError

func PromptAuthorizationAuthUIInternalServerError(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.AuthUIController) (http.ResponseWriter, error)

PromptAuthorizationAuthUIInternalServerError runs the method PromptAuthorization of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.

func ShowLoginLoginBadRequest

func ShowLoginLoginBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.LoginController) (http.ResponseWriter, error)

ShowLoginLoginBadRequest runs the method ShowLogin of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.

func ShowLoginLoginInternalServerError

func ShowLoginLoginInternalServerError(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.LoginController) (http.ResponseWriter, error)

ShowLoginLoginInternalServerError runs the method ShowLogin of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.

func ShowLoginLoginUnauthorized

func ShowLoginLoginUnauthorized(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.LoginController) (http.ResponseWriter, error)

ShowLoginLoginUnauthorized runs the method ShowLogin of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is created.

Types

type DummyClientService

type DummyClientService struct {
	Clients map[string]*oauth2.Client
	Auths   map[string]*oauth2.ClientAuth
}

func NewMockClientService

func NewMockClientService() *DummyClientService

func (*DummyClientService) ConfirmClientAuth

func (d *DummyClientService) ConfirmClientAuth(userID, clientID string) (*oauth2.ClientAuth, error)

func (*DummyClientService) DeleteClientAuth

func (d *DummyClientService) DeleteClientAuth(clientID, code string) error

func (*DummyClientService) GetClient

func (d *DummyClientService) GetClient(clientID string) (*oauth2.Client, error)

func (*DummyClientService) GetClientAuth

func (d *DummyClientService) GetClientAuth(clientID, code string) (*oauth2.ClientAuth, error)

func (*DummyClientService) GetClientAuthForUser

func (d *DummyClientService) GetClientAuthForUser(userID, clientID string) (*oauth2.ClientAuth, error)

func (*DummyClientService) SaveClientAuth

func (d *DummyClientService) SaveClientAuth(clientAuth *oauth2.ClientAuth) error

func (*DummyClientService) UpdateUserData

func (d *DummyClientService) UpdateUserData(clientID, code, userID, userData string) error

func (*DummyClientService) VerifyClientCredentials

func (d *DummyClientService) VerifyClientCredentials(clientID, clientSecret string) (*oauth2.Client, error)

type DummyKeyStore

type DummyKeyStore struct {
	PrivateKey interface{}
}

func NewDummyKeyStore

func NewDummyKeyStore() *DummyKeyStore

func (*DummyKeyStore) GetPrivateKey

func (d *DummyKeyStore) GetPrivateKey() (interface{}, error)

GetPrivateKey returns the default private key used for signing.

func (*DummyKeyStore) GetPrivateKeyByName

func (d *DummyKeyStore) GetPrivateKeyByName(keyName string) (interface{}, error)

GetPrivateKeyByName gets a private key by name

type DummyTokenService

type DummyTokenService struct {
	Tokens map[string]*oauth2.AuthToken
}

func (*DummyTokenService) GetToken

func (d *DummyTokenService) GetToken(refreshToken string) (*oauth2.AuthToken, error)

func (*DummyTokenService) GetTokenForClient

func (d *DummyTokenService) GetTokenForClient(userID, clientID string) (*oauth2.AuthToken, error)

func (*DummyTokenService) SaveToken

func (d *DummyTokenService) SaveToken(token oauth2.AuthToken) error

type DummyUserService

type DummyUserService struct {
	Users map[string]*MockUser
}

func (*DummyUserService) VerifyUser

func (d *DummyUserService) VerifyUser(email, password string) (*oauth2.User, error)

type MockSessionStore

type MockSessionStore struct {
	// contains filtered or unexported fields
}

func NewMockSessionStore

func NewMockSessionStore() *MockSessionStore

func (*MockSessionStore) Clear

func (m *MockSessionStore) Clear(key string, rw http.ResponseWriter, req *http.Request) error

func (*MockSessionStore) Get

func (m *MockSessionStore) Get(key string, req *http.Request) (*string, error)

func (*MockSessionStore) GetAs

func (m *MockSessionStore) GetAs(key string, v interface{}, req *http.Request) error

func (*MockSessionStore) Set

func (m *MockSessionStore) Set(key, value string, rw http.ResponseWriter, req *http.Request) error

func (*MockSessionStore) SetValue

func (m *MockSessionStore) SetValue(key string, value interface{}, rw http.ResponseWriter, req *http.Request) error

type MockUser

type MockUser struct {
	oauth2.User
	Password string
}

Jump to

Keyboard shortcuts

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