feat: remove v1
This commit is contained in:
84
backend/modules/tasks/discover_medias_test.go
Normal file
84
backend/modules/tasks/discover_medias_test.go
Normal file
@@ -0,0 +1,84 @@
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"backend/common/service/testx"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"go.uber.org/dig"
|
||||
)
|
||||
|
||||
type DiscoverMediasInjectParams struct {
|
||||
dig.In
|
||||
Svc *DiscoverMedias
|
||||
}
|
||||
|
||||
type DiscoverMediasTestSuite struct {
|
||||
suite.Suite
|
||||
DiscoverMediasInjectParams
|
||||
}
|
||||
|
||||
func Test_DiscoverMedias(t *testing.T) {
|
||||
providers := testx.Default().With(
|
||||
Provide,
|
||||
)
|
||||
|
||||
testx.Serve(providers, t, func(params DiscoverMediasInjectParams) {
|
||||
suite.Run(t, &DiscoverMediasTestSuite{DiscoverMediasInjectParams: params})
|
||||
})
|
||||
}
|
||||
|
||||
func (t *DiscoverMediasTestSuite) Test_getHashID() {
|
||||
Convey("TestDiscoverMedias_getHashID", t.T(), func() {
|
||||
hashId, err := t.Svc.getHashID(10, 11, 12)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
t.T().Logf("HashID: %s", hashId)
|
||||
})
|
||||
}
|
||||
|
||||
func (t *DiscoverMediasTestSuite) Test_getSubDirs() {
|
||||
Convey("Test_getSubDirs", t.T(), func() {
|
||||
dirs, err := t.Svc.getSubDirs("/mnt/yangpingliang/动态曲谱")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
t.T().Logf("Dirs: %+v", dirs)
|
||||
})
|
||||
}
|
||||
|
||||
func (t *DiscoverMediasTestSuite) Test_getVideo() {
|
||||
Convey("Test_getVideo", t.T(), func() {
|
||||
dirs := t.Svc.globVideo("/mnt/yangpingliang/动态曲谱/河北梆子伴奏《李慧娘》依然还我生前摸样")
|
||||
t.T().Logf("Dirs: %+v", dirs)
|
||||
})
|
||||
}
|
||||
|
||||
func (t *DiscoverMediasTestSuite) Test_getAudio() {
|
||||
Convey("Test_getAudio", t.T(), func() {
|
||||
dirs := t.Svc.globAudio("/mnt/yangpingliang/动态曲谱/河北梆子伴奏《李慧娘》依然还我生前摸样")
|
||||
t.T().Logf("Dirs: %+v", dirs)
|
||||
})
|
||||
}
|
||||
|
||||
func (t *DiscoverMediasTestSuite) Test_ffmpegVideoToM3U8() {
|
||||
Convey("Test_ffmpegVideoToM3U8", t.T(), func() {
|
||||
output := "/projects/mp-qvyun/backend/fixtures/medias/abc"
|
||||
os.RemoveAll(output)
|
||||
|
||||
err := t.Svc.ffmpegVideoToM3U8("/projects/mp-qvyun/backend/fixtures/medias/video.mp4", output)
|
||||
So(err, ShouldBeNil)
|
||||
})
|
||||
}
|
||||
|
||||
func (t *DiscoverMediasTestSuite) Test_parseM3u8File() {
|
||||
Convey("TestDiscoverMedias_parseM3u8File", t.T(), func() {
|
||||
file := "/projects/mp-qvyun/backend/fixtures/medias/abc/video/index.m3u8"
|
||||
playlist, err := t.Svc.parseM3u8File(file)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
t.T().Logf("ListType: %+v", playlist)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user