testutils

package
v1.4.17 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StartTime              = time.Now()
	TUMLiveContextStudent  = tools.TUMLiveContext{User: &Student}
	TUMLiveContextLecturer = tools.TUMLiveContext{User: &Lecturer}
	TUMLiveContextAdmin    = tools.TUMLiveContext{User: &Admin}
	TUMLiveContextUserNil  = tools.TUMLiveContext{User: nil}
	TUMLiveContextEmpty    = tools.TUMLiveContext{}
)

Misc

View Source
var (
	Student          = model.User{Model: gorm.Model{ID: 42}, Role: model.StudentType, PinnedCourses: []model.Course{CourseFPV}}
	Lecturer         = model.User{Model: gorm.Model{ID: 31}, Role: model.LecturerType}
	Admin            = model.User{Model: gorm.Model{ID: 0}, Role: model.AdminType}
	EmptyLectureHall = model.LectureHall{}
	LectureHall      = model.LectureHall{
		Model:          gorm.Model{ID: uint(1)},
		Name:           "FMI_HS1",
		FullName:       "MI HS1",
		CombIP:         "127.0.0.1/extron3",
		PresIP:         "127.0.0.1/extron1",
		CamIP:          "127.0.0.1/extron2",
		CameraIP:       "127.0.0.1",
		RoomID:         0,
		PwrCtrlIp:      "http://pwrctrlip.in.test.de",
		LiveLightIndex: 0,
	}
	CameraPreset = model.CameraPreset{
		Name:          "Home",
		PresetID:      1,
		Image:         "ccc47fae-847c-4a91-8a65-b26cbae6fbe2.jpg",
		LectureHallID: LectureHall.ID,
		IsDefault:     false,
	}
	CourseFPV = model.Course{
		Model:                gorm.Model{ID: uint(40)},
		UserID:               1,
		Name:                 "Funktionale Programmierung und Verifikation (IN0003)",
		Slug:                 "fpv",
		Year:                 2022,
		TeachingTerm:         "W",
		TUMOnlineIdentifier:  "2020",
		VODEnabled:           false,
		DownloadsEnabled:     false,
		ChatEnabled:          true,
		AnonymousChatEnabled: false,
		ModeratedChatEnabled: false,
		VodChatEnabled:       false,
		Visibility:           "public",
		Admins:               []model.User{Admin},
		Streams:              []model.Stream{StreamFPVLive, StreamFPVNotLive, SelfStream},
	}
	CourseGBS = model.Course{
		Model:                gorm.Model{ID: uint(42)},
		UserID:               1,
		Name:                 "Grundlagen: Betriebssysteme und Systemsoftware (IN0009)",
		Slug:                 "gbs",
		Year:                 0,
		TeachingTerm:         "W",
		TUMOnlineIdentifier:  "2021",
		VODEnabled:           false,
		DownloadsEnabled:     false,
		ChatEnabled:          true,
		AnonymousChatEnabled: false,
		ModeratedChatEnabled: false,
		VodChatEnabled:       false,
		Visibility:           "public",
	}
	CourseTensNet = model.Course{
		Model:                gorm.Model{ID: uint(55)},
		UserID:               1,
		Name:                 "Tensor Networks (IN2388)",
		Slug:                 "TensNet",
		Year:                 2023,
		TeachingTerm:         "S",
		TUMOnlineIdentifier:  "2023",
		VODEnabled:           false,
		DownloadsEnabled:     false,
		ChatEnabled:          true,
		AnonymousChatEnabled: false,
		ModeratedChatEnabled: false,
		VodChatEnabled:       false,
		Visibility:           "enrolled",
		Streams:              []model.Stream{StreamTensNetLive},
	}
	StreamFPVLive = model.Stream{
		Model:            gorm.Model{ID: 1969},
		Name:             "Lecture 1",
		Description:      "First official stream",
		CourseID:         40,
		Start:            StartTime,
		End:              StartTime.Add(time.Hour),
		ChatEnabled:      true,
		RoomName:         "00.08.038, Seminarraum",
		RoomCode:         "5608.EG.038",
		EventTypeName:    "Abhaltung",
		TUMOnlineEventID: 888261337,
		SeriesIdentifier: "e00a5d01-c530-41c5-8698-e40ec6d828ef",
		StreamKey:        "0dc3d-1337-1194-38f8-1337-7f16-bbe1-1337",
		PlaylistUrl:      "https://url",
		PlaylistUrlPRES:  "https://url",
		PlaylistUrlCAM:   "https://url",
		LiveNow:          true,
		LectureHallID:    LectureHall.ID,
		Files:            []model.File{Attachment, AttachmentInvalidPath},
		Units: []model.StreamUnit{
			{
				Model:           gorm.Model{ID: 1},
				UnitName:        "Unit 1",
				UnitDescription: "First unit",
				UnitStart:       0,
				UnitEnd:         1111,
				StreamID:        1969,
			},
		},
		VideoSections: []model.VideoSection{
			{
				Description:  "Introduction",
				StartHours:   0,
				StartMinutes: 0,
				StartSeconds: 0,
			},
			{
				Description:  "Proofs",
				StartHours:   1,
				StartMinutes: 33,
				StartSeconds: 7,
			},
		},
	}
	StreamFPVNotLive = model.Stream{
		Model:            gorm.Model{ID: 1969},
		Name:             "Lecture 1",
		Description:      "First official stream",
		CourseID:         40,
		Start:            StartTime,
		End:              StartTime.Add(time.Hour),
		ChatEnabled:      true,
		RoomName:         "00.08.038, Seminarraum",
		RoomCode:         "5608.EG.038",
		EventTypeName:    "Abhaltung",
		TUMOnlineEventID: 888261337,
		SeriesIdentifier: "e00a5d01-c530-41c5-8698-e40ec6d828ef",
		StreamKey:        "0dc3d-1337-1194-38f8-1337-7f16-bbe1-1337",
		PlaylistUrl:      "https://url",
		PlaylistUrlPRES:  "https://url",
		PlaylistUrlCAM:   "https://url",
		LiveNow:          false,
		LectureHallID:    LectureHall.ID,
	}
	StreamTensNetLive = model.Stream{
		Model:       gorm.Model{ID: 3333},
		Name:        "Tensor Contraction",
		Description: "C = A . B",
		CourseID:    55,
		Start:       time.Time{},
		End:         time.Time{},
		LiveNow:     true,
	}
	StreamGBSLive = model.Stream{
		Model:            gorm.Model{ID: 96},
		Name:             "Linker & Loader",
		Description:      "Tweedback: ...",
		CourseID:         CourseGBS.ID,
		Start:            StartTime,
		End:              StartTime.Add(time.Hour),
		ChatEnabled:      true,
		TUMOnlineEventID: 888333337,
		SeriesIdentifier: "",
		StreamKey:        "0dc3d-1337-7331-4201-1337-7f16-bbe1-2222",
		PlaylistUrl:      "https://url",
		PlaylistUrlPRES:  "https://url",
		PlaylistUrlCAM:   "https://url",
		LiveNow:          true,
	}
	SelfStream = model.Stream{
		Model:            gorm.Model{ID: 420},
		Name:             "Selfstream1",
		Description:      "First selfstream",
		CourseID:         40,
		Start:            StartTime,
		End:              StartTime.Add(time.Hour),
		ChatEnabled:      true,
		TUMOnlineEventID: 888261337,
		SeriesIdentifier: "",
		StreamKey:        "0dc3d-1337-1194-38f8-1337-7f16-bbe1-1111",
		PlaylistUrl:      "https://url",
		PlaylistUrlPRES:  "https://url",
		PlaylistUrlCAM:   "https://url",
		LiveNow:          false,
	}
	Worker1 = model.Worker{
		WorkerID: "ed067fa3-2364-4dcd-bfd2-e0ffb8d751d4",
		Host:     "localhost",
		Status:   "",
		Workload: 0,
		LastSeen: time.Now(),
	}
	Worker2 = model.Worker{
		WorkerID: "ed067fa3-2364-4dcd-bfd2-e0ffb8d751d4",
		Host:     "localhost",
		Status:   "",
		Workload: 0,
		LastSeen: time.Now(),
	}
	AdminToken = model.Token{
		UserID: Admin.ID,
		User:   Admin,
		Token:  "ed067f11-1337-4dcd-bfd2-4201b8d751d4",
		Scope:  model.TokenScopeAdmin,
	}
	Attachment = model.File{
		StreamID: 1969,
		Path:     "/tmp/test.txt",
		Filename: "test.txt",
		Type:     model.FILETYPE_ATTACHMENT,
	}
	AttachmentInvalidPath = model.File{
		StreamID: 1969,
		Path:     "/tmp/i_do_not_exist.txt",
		Filename: "i_do_not_exist.txt",
		Type:     model.FILETYPE_ATTACHMENT,
	}
	InfoPage = model.InfoPage{
		Model:      gorm.Model{ID: 1},
		Name:       "Data Privacy",
		RawContent: "#data privacy",
		Type:       model.INFOPAGE_MARKDOWN,
	}
	FPVNotLiveVideoSeekChunk1 = model.VideoSeekChunk{
		ChunkIndex: 1,
		StreamID:   StreamFPVNotLive.ID,
		Hits:       247,
	}
	FPVNotLiveVideoSeekChunk2 = model.VideoSeekChunk{
		ChunkIndex: 2,
		StreamID:   StreamFPVNotLive.ID,
		Hits:       112,
	}
	FPVNotLiveVideoSeekChunk3 = model.VideoSeekChunk{
		ChunkIndex: 3,
		StreamID:   StreamFPVNotLive.ID,
		Hits:       788,
	}
	Bookmark = model.Bookmark{
		Model:       gorm.Model{ID: 1},
		Description: "Klausurrelevant",
		Hours:       1,
		Minutes:     33,
		Seconds:     7,
		UserID:      Student.ID,
		StreamID:    StreamFPVLive.ID,
	}
	PollStreamFPVLive = model.Poll{
		Model:    gorm.Model{ID: uint(3)},
		StreamID: StreamFPVLive.ID,
		Stream:   StreamFPVLive,
		Question: "1+1=?",
		Active:   true,
		PollOptions: []model.PollOption{
			{Model: gorm.Model{ID: 0}, Answer: "2", Votes: []model.User{Student}},
			{Model: gorm.Model{ID: 1}, Answer: "3", Votes: []model.User{}},
		},
	}
	SubtitlesFPVLive = model.Subtitles{
		StreamID: StreamFPVLive.ID,
		Content:  "wonderful",
		Language: "en",
	}
)

Models

Functions

func CreateVideoSeekData

func CreateVideoSeekData(streamId uint, chunkCount int) ([]model.VideoSeekChunk, gin.H)

CreateVideoSeekData returns list of generated VideoSeekChunk and expected response object

func Equal

func Equal(t *testing.T, a, b interface{})

func GetAuditMock

func GetAuditMock(t *testing.T) dao.AuditDao

func GetCoursesMock

func GetCoursesMock(t *testing.T) dao.CoursesDao

func GetFileMock

func GetFileMock(t *testing.T) dao.FileDao

func GetLectureHallMock

func GetLectureHallMock(t *testing.T) dao.LectureHallsDao

func GetMiddlewares

func GetMiddlewares(mw ...func(ctx *gin.Context)) []func(c *gin.Context)

func GetPresetUtilityMock

func GetPresetUtilityMock(ctrl *gomock.Controller) tools.PresetUtility

func GetProgressMock

func GetProgressMock(t *testing.T) dao.ProgressDao

func GetStreamMock

func GetStreamMock(t *testing.T) dao.StreamsDao

func GetTokenMock

func GetTokenMock(t *testing.T) dao.TokenDao

func GetUploadKeyMock

func GetUploadKeyMock(t *testing.T) dao.UploadKeyDao

func GetUsersMock

func GetUsersMock(t *testing.T) dao.UsersDao

func TUMLiveContext

func TUMLiveContext(ctx tools.TUMLiveContext) func(c *gin.Context)

Types

This section is empty.

Jump to

Keyboard shortcuts

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