roomAdmin_test.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package v1
  2. import (
  3. "context"
  4. "flag"
  5. "go-common/app/interface/live/app-ucenter/api/http/v1"
  6. "go-common/app/interface/live/app-ucenter/conf"
  7. "go-common/library/net/metadata"
  8. "testing"
  9. . "github.com/smartystreets/goconvey/convey"
  10. "github.com/smartystreets/goconvey/convey"
  11. )
  12. var roomadmin *RoomAdminService
  13. func init() {
  14. flag.Set("conf", "../../cmd/test.toml")
  15. if err := conf.Init(); err != nil {
  16. panic(err)
  17. }
  18. roomadmin = NewRoomAdminService(conf.Conf)
  19. }
  20. func TestV1ShowEntry(t *testing.T) {
  21. convey.Convey("ShowEntry", t, func() {
  22. ctx := metadata.NewContext(context.TODO(), metadata.MD{
  23. metadata.Mid: int64(10000),
  24. })
  25. res, err := roomadmin.ShowEntry(ctx, &v1.ShowEntryReq{})
  26. t.Logf("%v,%s", res, err)
  27. So(err, ShouldBeNil)
  28. })
  29. }
  30. func TestV1SearchForAdmin(t *testing.T) {
  31. convey.Convey("SearchForAdmin", t, func() {
  32. ctx := metadata.NewContext(context.TODO(), metadata.MD{
  33. metadata.Mid: int64(10000),
  34. })
  35. res, err := roomadmin.SearchForAdmin(ctx, &v1.RoomAdminSearchForAdminReq{
  36. KeyWord: "test",
  37. })
  38. t.Logf("%v,%s", res, err)
  39. So(err, ShouldBeNil)
  40. })
  41. }
  42. func TestV1IsAny(t *testing.T) {
  43. convey.Convey("IsAny", t, func() {
  44. ctx := metadata.NewContext(context.TODO(), metadata.MD{
  45. metadata.Mid: int64(10000),
  46. })
  47. res, err := roomadmin.IsAny(ctx, &v1.ShowEntryReq{})
  48. t.Logf("%v,%s", res, err)
  49. So(err, ShouldBeNil)
  50. })
  51. }