Live video on the AT Protocol
1package media
2
3import (
4 "context"
5 "path/filepath"
6 "runtime"
7 "testing"
8
9 "github.com/stretchr/testify/require"
10 "stream.place/streamplace/pkg/atproto"
11 "stream.place/streamplace/pkg/bus"
12 "stream.place/streamplace/pkg/config"
13 ct "stream.place/streamplace/pkg/config/configtesting"
14 "stream.place/streamplace/pkg/model"
15 "stream.place/streamplace/pkg/statedb"
16)
17
18func getFixture(name string) string {
19 _, filename, _, _ := runtime.Caller(0)
20 dir := filepath.Dir(filename)
21 return filepath.Join(dir, "..", "..", "test", "fixtures", name)
22}
23
24func getStaticTestMediaManager(t *testing.T) (*MediaManager, MediaSigner) {
25 mod, err := model.MakeDB(":memory:")
26 require.NoError(t, err)
27 // signer, err := c2pa.MakeStaticSigner(eip712test.KeyBytes)
28 require.NoError(t, err)
29 if err != nil {
30 panic(err)
31 }
32 cli := ct.CLI(t, &config.CLI{
33 TAURL: "http://timestamp.digicert.com",
34 AllowedStreams: []string{"did:plc:2j2ounbiyi3ftihronlw5qhj"},
35 DBURL: ":memory:",
36 })
37 statedb, err := statedb.MakeDB(context.Background(), cli, nil, mod)
38 require.NoError(t, err)
39 atsync := &atproto.ATProtoSynchronizer{
40 CLI: cli,
41 Model: mod,
42 StatefulDB: statedb,
43 Bus: bus.NewBus(),
44 }
45 mm, err := MakeMediaManager(context.Background(), cli, nil, mod, bus.NewBus(), atsync)
46 require.NoError(t, err)
47 // ms, err := MakeMediaSigner(context.Background(), cli, "test-person", signer)
48 // require.NoError(t, err)
49 return mm, nil
50}