Documentation ¶
Index ¶
- Constants
- Variables
- func CreateCourse(t *testing.T, db database.Database, user *qf.User, course *qf.Course)
- func CreateFakeCustomUser(t *testing.T, db database.Database, user *qf.User) *qf.User
- func CreateFakeUser(t *testing.T, db database.Database) *qf.User
- func EnrollStudent(t *testing.T, db database.Database, student *qf.User, course *qf.Course)
- func EnrollTeacher(t *testing.T, db database.Database, student *qf.User, course *qf.Course)
- func EnrollUser(t *testing.T, db database.Database, user *qf.User, course *qf.Course, ...) *qf.Enrollment
- func Logger(t *testing.T) *zap.SugaredLogger
- func RandomString(t *testing.T) string
- func RequestWithCookie[T any](message *T, cookie string) *connect.Request[T]
- func TestDB(t *testing.T) (database.Database, func())
- func Timestamp(t *testing.T, tim string) *timestamppb.Timestamp
- type MockStream
Constants ¶
View Source
const MockOrg = "qf102-2022"
Variables ¶
View Source
var MockCourses = []*qf.Course{ { Name: "Distributed Systems", CourseCreatorID: 1, Code: "DAT520", Year: 2018, Tag: "Spring", ScmOrganizationID: 1, ScmOrganizationName: MockOrg, }, { Name: "Operating Systems", CourseCreatorID: 1, Code: "DAT320", Year: 2017, Tag: "Fall", ScmOrganizationID: 2, ScmOrganizationName: "DAT320", }, { Name: "New Systems", CourseCreatorID: 1, Code: "DATx20", Year: 2019, Tag: "Fall", ScmOrganizationID: 3, ScmOrganizationName: "DATx20-2019", }, { Name: "Hyped Systems", CourseCreatorID: 1, Code: "QF104", Year: 2022, Tag: "Fall", ScmOrganizationID: 4, ScmOrganizationName: "qf104-2022", }, }
Functions ¶
func CreateCourse ¶
func CreateFakeCustomUser ¶
func CreateFakeUser ¶
CreateFakeUser is a test helper to create a user in the database.
func EnrollStudent ¶
func EnrollTeacher ¶
func EnrollUser ¶
func RandomString ¶
func RequestWithCookie ¶
Types ¶
type MockStream ¶
type MockStream[T any] struct { Messages []*T MessageMap map[string]int // contains filtered or unexported fields }
func NewMockStream ¶
func NewMockStream[T any](t *testing.T) *MockStream[T]
func (*MockStream[T]) Close ¶
func (m *MockStream[T]) Close()
func (*MockStream[T]) GetChannel ¶
func (m *MockStream[T]) GetChannel() chan *T
func (*MockStream[T]) Run ¶
func (m *MockStream[T]) Run() error
func (*MockStream[T]) Send ¶
func (m *MockStream[T]) Send(data *T)
func (*MockStream[T]) SetCounter ¶
func (m *MockStream[T]) SetCounter(counter *uint32)
SetCounter sets the counter used to count the number of messages sent. Multiple streams can share the same counter to count the total number of messages sent across all streams.
Click to show internal directories.
Click to hide internal directories.