30 lines
714 B
Go
30 lines
714 B
Go
package imgsource
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func TestCS3AuthorizationPreservesVideoSourceMarker(t *testing.T) {
|
|
ctx := ContextSetVideoSource(context.Background(), true)
|
|
ctx = withCS3Authorization(ctx, "token")
|
|
|
|
if !contextIsVideoSource(ctx) {
|
|
t.Fatal("CS3 authorization must preserve the video source marker")
|
|
}
|
|
}
|
|
|
|
func TestDetachedVideoDownloadSurvivesCallerCancellation(t *testing.T) {
|
|
parent, cancelParent := context.WithCancel(context.Background())
|
|
download, cancelDownload := detachedVideoDownloadContext(parent)
|
|
defer cancelDownload()
|
|
|
|
cancelParent()
|
|
|
|
select {
|
|
case <-download.Done():
|
|
t.Fatal("video cache warming must continue after the requesting client disconnects")
|
|
default:
|
|
}
|
|
}
|