go-common/app/interface/live/app-ucenter/service/v1/roomAdmin_test.go

60 lines
1.3 KiB
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package v1
import (
"context"
"flag"
"go-common/app/interface/live/app-ucenter/api/http/v1"
"go-common/app/interface/live/app-ucenter/conf"
"go-common/library/net/metadata"
"testing"
. "github.com/smartystreets/goconvey/convey"
"github.com/smartystreets/goconvey/convey"
)
var roomadmin *RoomAdminService
func init() {
flag.Set("conf", "../../cmd/test.toml")
if err := conf.Init(); err != nil {
panic(err)
}
roomadmin = NewRoomAdminService(conf.Conf)
}
func TestV1ShowEntry(t *testing.T) {
convey.Convey("ShowEntry", t, func() {
ctx := metadata.NewContext(context.TODO(), metadata.MD{
metadata.Mid: int64(10000),
})
res, err := roomadmin.ShowEntry(ctx, &v1.ShowEntryReq{})
t.Logf("%v,%s", res, err)
So(err, ShouldBeNil)
})
}
func TestV1SearchForAdmin(t *testing.T) {
convey.Convey("SearchForAdmin", t, func() {
ctx := metadata.NewContext(context.TODO(), metadata.MD{
metadata.Mid: int64(10000),
})
res, err := roomadmin.SearchForAdmin(ctx, &v1.RoomAdminSearchForAdminReq{
KeyWord: "test",
})
t.Logf("%v,%s", res, err)
So(err, ShouldBeNil)
})
}
func TestV1IsAny(t *testing.T) {
convey.Convey("IsAny", t, func() {
ctx := metadata.NewContext(context.TODO(), metadata.MD{
metadata.Mid: int64(10000),
})
res, err := roomadmin.IsAny(ctx, &v1.ShowEntryReq{})
t.Logf("%v,%s", res, err)
So(err, ShouldBeNil)
})
}