go-common/app/job/main/archive/dao/result/video_test.go

44 lines
957 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package result
import (
"context"
"testing"
"go-common/app/job/main/archive/model/archive"
. "github.com/smartystreets/goconvey/convey"
)
func Test_TxAddVideo(t *testing.T) {
Convey("Archive", t, func() {
tx, err := d.BeginTran(context.TODO())
So(err, ShouldBeNil)
_, err = d.TxAddVideo(context.TODO(), tx, &archive.Video{Aid: 1, Cid: 1})
So(err, ShouldBeNil)
err = tx.Commit()
So(err, ShouldBeNil)
})
}
func Test_TxDelVideoByCid(t *testing.T) {
Convey("TxDelVideoByCid", t, func() {
tx, err := d.BeginTran(context.TODO())
So(err, ShouldBeNil)
_, err = d.TxDelVideoByCid(context.TODO(), tx, 1, 1)
So(err, ShouldBeNil)
err = tx.Commit()
So(err, ShouldBeNil)
})
}
func Test_TxDelVideos(t *testing.T) {
Convey("TxDelVideos", t, func() {
tx, err := d.BeginTran(context.TODO())
So(err, ShouldBeNil)
_, err = d.TxDelVideos(context.TODO(), tx, 0)
So(err, ShouldBeNil)
err = tx.Commit()
So(err, ShouldBeNil)
})
}