Documentation ¶
Index ¶
- func AssertResponseError(t *testing.T, rr *httptest.ResponseRecorder, statusCode int, ...)
- func AssertResponseExpected(t *testing.T, rr *httptest.ResponseRecorder, expResponse interface{}, ...)
- func AssertResponseForbidden(t *testing.T, rr *httptest.ResponseRecorder)
- func AssertResponseInternalServerError(t *testing.T, rr *httptest.ResponseRecorder)
- func AuthenticateUserWithCookie(t *testing.T, config *config.Config, user *models.User, badUserIDType bool) *http.Cookie
- func AuthenticateUserWithToken(t *testing.T, config *config.Config, userID uint) string
- func CreateTestUser(t *testing.T, config *config.Config, verified bool) *models.User
- func GetRequestAndRecorder(t *testing.T, method, route string, requestObj interface{}) (*http.Request, *httptest.ResponseRecorder)
- func LoadConfig(t *testing.T, failingRepoMethods ...string) *config.Config
- func NewFailingDecoderValidator(config *config.Config) shared.RequestDecoderValidator
- func NewFakeUserNotifier() notifier.UserNotifier
- func NewTestConfigLoader(canQuery bool, failingRepoMethods ...string) config.ConfigLoader
- func WithAuthenticatedUser(t *testing.T, req *http.Request, user *models.User) *http.Request
- func WithProject(t *testing.T, req *http.Request, proj *models.Project) *http.Request
- func WithRequestScopes(t *testing.T, req *http.Request, ...) *http.Request
- func WithURLParams(t *testing.T, req *http.Request, params map[string]string) *http.Request
- type FakeUserNotifier
- func (f *FakeUserNotifier) GetGithubRelinkEmailLastOpts() *notifier.SendGithubRelinkEmailOpts
- func (f *FakeUserNotifier) GetPasswordResetEmailLastOpts() *notifier.SendPasswordResetEmailOpts
- func (f *FakeUserNotifier) GetSendEmailVerificationLastOpts() *notifier.SendEmailVerificationOpts
- func (f *FakeUserNotifier) GetSendProjectInviteEmailLastOpts() *notifier.SendProjectInviteEmailOpts
- func (f *FakeUserNotifier) SendEmailVerification(opts *notifier.SendEmailVerificationOpts) error
- func (f *FakeUserNotifier) SendGithubRelinkEmail(opts *notifier.SendGithubRelinkEmailOpts) error
- func (f *FakeUserNotifier) SendPasswordResetEmail(opts *notifier.SendPasswordResetEmailOpts) error
- func (f *FakeUserNotifier) SendProjectInviteEmail(opts *notifier.SendProjectInviteEmailOpts) error
- type TestConfigLoader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertResponseError ¶
func AssertResponseError(t *testing.T, rr *httptest.ResponseRecorder, statusCode int, expReqErr *types.ExternalError)
func AssertResponseExpected ¶
func AssertResponseExpected(t *testing.T, rr *httptest.ResponseRecorder, expResponse interface{}, gotTarget interface{})
func AssertResponseForbidden ¶
func AssertResponseForbidden(t *testing.T, rr *httptest.ResponseRecorder)
func AssertResponseInternalServerError ¶
func AssertResponseInternalServerError(t *testing.T, rr *httptest.ResponseRecorder)
func AuthenticateUserWithCookie ¶
func AuthenticateUserWithCookie( t *testing.T, config *config.Config, user *models.User, badUserIDType bool, ) *http.Cookie
AuthenticateUserWithCookie uses the session store to create a cookie for a user
func AuthenticateUserWithToken ¶
AuthenticateUserWithToken uses the JWT token generator to create a token for a user
func CreateTestUser ¶
func GetRequestAndRecorder ¶
func NewFailingDecoderValidator ¶
func NewFailingDecoderValidator(config *config.Config) shared.RequestDecoderValidator
func NewFakeUserNotifier ¶
func NewFakeUserNotifier() notifier.UserNotifier
func NewTestConfigLoader ¶
func NewTestConfigLoader(canQuery bool, failingRepoMethods ...string) config.ConfigLoader
func WithAuthenticatedUser ¶
func WithProject ¶
func WithRequestScopes ¶
func WithRequestScopes(t *testing.T, req *http.Request, reqScopes map[types.PermissionScope]*types.RequestAction) *http.Request
Types ¶
type FakeUserNotifier ¶
type FakeUserNotifier struct {
// contains filtered or unexported fields
}
FakeUserNotifier just stores data about a single notification, without sending the data anywhere
func (*FakeUserNotifier) GetGithubRelinkEmailLastOpts ¶
func (f *FakeUserNotifier) GetGithubRelinkEmailLastOpts() *notifier.SendGithubRelinkEmailOpts
func (*FakeUserNotifier) GetPasswordResetEmailLastOpts ¶
func (f *FakeUserNotifier) GetPasswordResetEmailLastOpts() *notifier.SendPasswordResetEmailOpts
func (*FakeUserNotifier) GetSendEmailVerificationLastOpts ¶
func (f *FakeUserNotifier) GetSendEmailVerificationLastOpts() *notifier.SendEmailVerificationOpts
func (*FakeUserNotifier) GetSendProjectInviteEmailLastOpts ¶
func (f *FakeUserNotifier) GetSendProjectInviteEmailLastOpts() *notifier.SendProjectInviteEmailOpts
func (*FakeUserNotifier) SendEmailVerification ¶
func (f *FakeUserNotifier) SendEmailVerification(opts *notifier.SendEmailVerificationOpts) error
func (*FakeUserNotifier) SendGithubRelinkEmail ¶
func (f *FakeUserNotifier) SendGithubRelinkEmail(opts *notifier.SendGithubRelinkEmailOpts) error
func (*FakeUserNotifier) SendPasswordResetEmail ¶
func (f *FakeUserNotifier) SendPasswordResetEmail(opts *notifier.SendPasswordResetEmailOpts) error
func (*FakeUserNotifier) SendProjectInviteEmail ¶
func (f *FakeUserNotifier) SendProjectInviteEmail(opts *notifier.SendProjectInviteEmailOpts) error
type TestConfigLoader ¶
type TestConfigLoader struct {
// contains filtered or unexported fields
}
func (*TestConfigLoader) LoadConfig ¶
func (t *TestConfigLoader) LoadConfig() (*config.Config, error)
Click to show internal directories.
Click to hide internal directories.