tests

package
v0.0.0-...-e173b71 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FakeAttendeeJWT

func FakeAttendeeJWT(t *testing.T, userID string) string

func FakeTrainerJWT

func FakeTrainerJWT(t *testing.T, userID string) string

func RelativeDate

func RelativeDate(days int, hour int) time.Time

RelativeDate returns a date in the future in specified days and hours. This allows running the tests in parallel, since each test uses different date and hour.

The downside of this approach is that you need to be aware of used dates when adding a new test. In our case this is not an issue, as it's trivial to see all usages and there's just a few of them.

Another, more complex approach, would be to use random dates and retry in case of an error.

func WaitForPort

func WaitForPort(address string) bool

Types

type TrainerHTTPClient

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

func NewTrainerHTTPClient

func NewTrainerHTTPClient(t *testing.T, token string) TrainerHTTPClient

func (TrainerHTTPClient) GetTrainerAvailableHours

func (c TrainerHTTPClient) GetTrainerAvailableHours(t *testing.T, from time.Time, to time.Time) []trainer.Date

func (TrainerHTTPClient) MakeHourAvailable

func (c TrainerHTTPClient) MakeHourAvailable(t *testing.T, hour time.Time) int

func (TrainerHTTPClient) MakeHourUnavailable

func (c TrainerHTTPClient) MakeHourUnavailable(t *testing.T, hour time.Time)

type TrainingsHTTPClient

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

func NewTrainingsHTTPClient

func NewTrainingsHTTPClient(t *testing.T, token string) TrainingsHTTPClient

func (TrainingsHTTPClient) CancelTraining

func (c TrainingsHTTPClient) CancelTraining(t *testing.T, trainingUUID string, expectedStatusCode int)

func (TrainingsHTTPClient) CreateTraining

func (c TrainingsHTTPClient) CreateTraining(t *testing.T, note string, hour time.Time) string

func (TrainingsHTTPClient) CreateTrainingShouldFail

func (c TrainingsHTTPClient) CreateTrainingShouldFail(t *testing.T, note string, hour time.Time)

func (TrainingsHTTPClient) GetTrainings

func (c TrainingsHTTPClient) GetTrainings(t *testing.T) trainings.Trainings

type UsersHTTPClient

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

func NewUsersHTTPClient

func NewUsersHTTPClient(t *testing.T, token string) UsersHTTPClient

func (UsersHTTPClient) GetCurrentUser

func (c UsersHTTPClient) GetCurrentUser(t *testing.T) users.User

Jump to

Keyboard shortcuts

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