123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package dao
- import (
- "context"
- "testing"
- "go-common/app/interface/main/dm2/model"
- . "github.com/smartystreets/goconvey/convey"
- )
- func TestSetXMLSegCache(t *testing.T) {
- Convey("", t, func() {
- err := testDao.SetXMLSegCache(context.TODO(), model.SubTypeVideo, 1221, 1, 1, []byte("test"))
- So(err, ShouldBeNil)
- })
- }
- func TestXMLSegCache(t *testing.T) {
- Convey("", t, func() {
- _, err := testDao.XMLSegCache(context.TODO(), model.SubTypeVideo, 1221, 1, 1)
- So(err, ShouldBeNil)
- })
- }
- func TestDurationCache(t *testing.T) {
- var (
- oid int64 = 1508
- c = context.TODO()
- )
- Convey("", t, func() {
- _, err := testDao.DurationCache(c, oid)
- So(err, ShouldBeNil)
- })
- }
- func TestSetDurationCache(t *testing.T) {
- var (
- oid int64 = 1508
- duration int64 = 9031 * 1000
- c = context.TODO()
- )
- Convey("", t, func() {
- err := testDao.SetDurationCache(c, oid, duration)
- So(err, ShouldBeNil)
- })
- }
- func TestSetDMSegCache(t *testing.T) {
- Convey("set dm segment cache, error should be nil", t, func() {
- dmseg := new(model.DMSeg)
- dmseg.Elems = append(dmseg.Elems, &model.Elem{Content: "dm msg"})
- err := testDao.SetDMSegCache(c, 1, 1221, 1, 1, dmseg)
- So(err, ShouldBeNil)
- })
- }
- func TestDMSegCache(t *testing.T) {
- Convey("get dm segment cache", t, func() {
- dmseg, err := testDao.DMSegCache(c, 1, 1221, 1, 1)
- if err != nil {
- t.Fatal(err)
- }
- t.Logf("%+v", dmseg)
- })
- }
|