123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- package archive
- import (
- "context"
- "testing"
- . "github.com/smartystreets/goconvey/convey"
- "go-common/app/service/main/videoup/model/archive"
- )
- func TestDao_TxAddVideoCid(t *testing.T) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- v = &archive.Video{
- Aid: 23333,
- Cid: 12121,
- Title: "sssss",
- }
- )
- Convey("TxAddVideoCid", t, func(ctx C) {
- _, err := d.TxAddVideoCid(tx, v)
- if err != nil {
- tx.Rollback()
- } else {
- tx.Commit()
- }
- So(err, ShouldBeNil)
- })
- }
- func TestDao_AddNewVideo(t *testing.T) {
- var (
- c = context.Background()
- v = &archive.Video{
- Aid: 23333,
- Cid: 12121,
- Title: "sssss",
- }
- )
- Convey("AddNewVideo", t, func(ctx C) {
- _, err := d.AddNewVideo(c, v)
- So(err, ShouldBeNil)
- })
- }
- func TestDao_TxAddNewVideo(t *testing.T) {
- var (
- c = context.Background()
- v = &archive.Video{
- Aid: 23333,
- Cid: 12121,
- Title: "sssss",
- }
- tx, _ = d.BeginTran(c)
- )
- Convey("TxAddNewVideo", t, func(ctx C) {
- _, err := d.TxAddNewVideo(tx, v)
- if err != nil {
- tx.Rollback()
- } else {
- tx.Commit()
- }
- So(err, ShouldBeNil)
- })
- }
- func TestDao_TxAddVideoRelation(t *testing.T) {
- var (
- c = context.Background()
- v = &archive.Video{
- Aid: 23333,
- Cid: 12121,
- Title: "sssss",
- }
- tx, _ = d.BeginTran(c)
- )
- Convey("TxAddVideoRelation", t, func(ctx C) {
- _, err := d.TxAddVideoRelation(tx, v)
- if err != nil {
- tx.Rollback()
- } else {
- tx.Commit()
- }
- So(err, ShouldBeNil)
- })
- }
- func TestDao_TxUpVideoRelation(t *testing.T) {
- var (
- c = context.Background()
- v = &archive.Video{
- Aid: 23333,
- Cid: 12121,
- Title: "sssss",
- }
- tx, _ = d.BeginTran(c)
- )
- Convey("TxUpVideoRelation", t, func(ctx C) {
- _, err := d.TxUpVideoRelation(tx, v)
- if err != nil {
- tx.Rollback()
- } else {
- tx.Commit()
- }
- So(err, ShouldBeNil)
- })
- }
- func TestDao_TxUpRelationState(t *testing.T) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- )
- Convey("TxUpRelationState", t, func(ctx C) {
- _, err := d.TxUpRelationState(tx, 23333, 1212, 0)
- if err != nil {
- tx.Rollback()
- } else {
- tx.Commit()
- }
- So(err, ShouldBeNil)
- })
- }
- func TestDao_TxUpVdoStatus(t *testing.T) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- )
- Convey("TxUpVdoStatus", t, func(ctx C) {
- _, err := d.TxUpVdoStatus(tx, 1212, 0)
- if err != nil {
- tx.Rollback()
- } else {
- tx.Commit()
- }
- So(err, ShouldBeNil)
- })
- }
- func TestDao_TxUpNewVideo(t *testing.T) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- v = &archive.Video{
- Aid: 23333,
- Cid: 12121,
- Title: "sssss",
- }
- )
- Convey("TxUpNewVideo", t, func(ctx C) {
- _, err := d.TxUpNewVideo(tx, v)
- if err != nil {
- tx.Rollback()
- } else {
- tx.Commit()
- }
- So(err, ShouldBeNil)
- })
- }
- func TestDao_NewCidsByFns(t *testing.T) {
- var (
- c = context.Background()
- vs = []*archive.Video{{
- Filename: "1212121243gf",
- }}
- )
- Convey("NewCidsByFns", t, func(ctx C) {
- _, err := d.NewCidsByFns(c, vs)
- So(err, ShouldBeNil)
- })
- }
- func TestDao_CheckNewVideosTimeout(t *testing.T) {
- var (
- c = context.Background()
- fs = []string{"1212121243gf"}
- )
- Convey("CheckNewVideosTimeout", t, func(ctx C) {
- _, _, err := d.CheckNewVideosTimeout(c, fs)
- So(err, ShouldBeNil)
- })
- }
- func TestDao_ParseDimensions(t *testing.T) {
- Convey("CheckNewVideosTimeout", t, func(ctx C) {
- _, err := d.parseDimensions("1,2,3")
- So(err, ShouldBeNil)
- })
- }
- func TestArchiveNewVideoFn(t *testing.T) {
- var (
- c = context.Background()
- filename = "23333333333"
- )
- Convey("NewVideoFn", t, func(ctx C) {
- _, err := d.NewVideoFn(c, filename)
- ctx.Convey("Then err should be nil.v should not be nil.", func(ctx C) {
- ctx.So(err, ShouldBeNil)
- })
- })
- }
- func TestArchiveNewVideoByFn(t *testing.T) {
- var (
- c = context.Background()
- filename = "23333333333"
- )
- Convey("NewVideoByFn", t, func(ctx C) {
- _, err := d.NewVideoByFn(c, filename)
- ctx.Convey("Then err should be nil.v should not be nil.", func(ctx C) {
- ctx.So(err, ShouldBeNil)
- })
- })
- }
- func TestArchiveSimpleArcVideos(t *testing.T) {
- var (
- c = context.Background()
- aid = int64(2333333)
- )
- Convey("SimpleArcVideos", t, func(ctx C) {
- _, err := d.SimpleArcVideos(c, aid)
- ctx.Convey("Then err should be nil.vs should not be nil.", func(ctx C) {
- ctx.So(err, ShouldBeNil)
- })
- })
- }
- func TestArchiveNewVideos(t *testing.T) {
- var (
- c = context.Background()
- aid = int64(2333333)
- )
- Convey("NewVideos", t, func(ctx C) {
- _, err := d.NewVideos(c, aid)
- ctx.Convey("Then err should be nil.vs should not be nil.", func(ctx C) {
- ctx.So(err, ShouldBeNil)
- })
- })
- }
- func TestArchiveNewVideoMap(t *testing.T) {
- var (
- c = context.Background()
- aid = int64(23333)
- )
- Convey("NewVideoMap", t, func(ctx C) {
- _, _, err := d.NewVideoMap(c, aid)
- ctx.Convey("Then err should be nil.vm,cvm should not be nil.", func(ctx C) {
- ctx.So(err, ShouldBeNil)
- })
- })
- }
- func TestArchiveNewVideoByCID(t *testing.T) {
- var (
- c = context.Background()
- cid = int64(23333)
- )
- Convey("NewVideoByCID", t, func(ctx C) {
- _, err := d.NewVideoByCID(c, cid)
- ctx.Convey("Then err should be nil.v should not be nil.", func(ctx C) {
- ctx.So(err, ShouldBeNil)
- })
- })
- }
- func TestArchiveNewVideosByCID(t *testing.T) {
- var (
- c = context.Background()
- cids = []int64{23333}
- )
- Convey("NewVideosByCID", t, func(ctx C) {
- _, err := d.NewVideosByCID(c, cids)
- ctx.Convey("Then err should be nil.vm should not be nil.", func(ctx C) {
- ctx.So(err, ShouldBeNil)
- })
- })
- }
- func TestArchiveNewVideosByFn(t *testing.T) {
- var (
- c = context.Background()
- fns = []string{"23333"}
- )
- Convey("NewVideosByFn", t, func(ctx C) {
- _, err := d.NewVideosByFn(c, fns)
- ctx.Convey("Then err should be nil.vm should not be nil.", func(ctx C) {
- ctx.So(err, ShouldBeNil)
- })
- })
- }
- func TestArchiveNewVideosReason(t *testing.T) {
- var (
- c = context.Background()
- aid = int64(23333)
- )
- Convey("NewVideosReason", t, func(ctx C) {
- _, err := d.NewVideosReason(c, aid)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx C) {
- ctx.So(err, ShouldBeNil)
- })
- })
- }
|