go-common/app/interface/main/app-resource/dao/abtest/abtest_test.go
2019-04-22 18:49:16 +08:00

60 lines
1.0 KiB
Go

package abtest
import (
"context"
"flag"
"path/filepath"
"testing"
"time"
"go-common/app/interface/main/app-resource/conf"
. "github.com/smartystreets/goconvey/convey"
)
var (
d *Dao
)
func ctx() context.Context {
return context.Background()
}
func init() {
dir, _ := filepath.Abs("../../cmd/app-resource-test.toml")
flag.Set("conf", dir)
conf.Init()
d = New(conf.Conf)
time.Sleep(time.Second)
}
func TestExperimentLimit(t *testing.T) {
Convey("get ExperimentLimit all", t, func() {
res, err := d.ExperimentLimit(ctx())
So(err, ShouldBeNil)
So(res, ShouldNotBeEmpty)
})
}
func TestExperimentByIDs(t *testing.T) {
Convey("get ExperimentByIDs all", t, func() {
res, err := d.ExperimentByIDs(ctx(), []int64{1})
So(err, ShouldBeNil)
So(res, ShouldNotBeEmpty)
})
}
func TestAbServer(t *testing.T) {
Convey("TestAbServer", t, func() {
res, err := d.AbServer(context.TODO(),
"9902822F-DDD1-47BC-A08F-19F746C9CB8459220infoc",
"phone",
"iphone",
"",
6720,
1,
)
Println(string(res), err)
})
}