dao_test.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package user
  2. import (
  3. "context"
  4. "flag"
  5. . "github.com/smartystreets/goconvey/convey"
  6. "go-common/app/interface/live/web-ucenter/conf"
  7. "go-common/app/interface/live/web-ucenter/dao"
  8. "testing"
  9. )
  10. var d *Dao
  11. func init() {
  12. flag.Set("conf", "../../cmd/test.toml")
  13. flag.Set("env", "uat")
  14. var err error
  15. if err = conf.Init(); err != nil {
  16. panic(err)
  17. }
  18. dao.InitAPI()
  19. d = New(conf.Conf)
  20. }
  21. var (
  22. uid = int64(110000681)
  23. ctx = context.Background()
  24. )
  25. func TestDao_GetAccountProfile(t *testing.T) {
  26. Convey("test get account profile", t, func() {
  27. profile, err := d.GetAccountProfile(ctx, uid)
  28. So(profile, ShouldNotBeNil)
  29. So(err, ShouldBeNil)
  30. })
  31. }
  32. func TestDao_GetWallet(t *testing.T) {
  33. Convey("test get wallet", t, func() {
  34. _, _, err := d.GetWallet(ctx, uid, "pc")
  35. So(err, ShouldBeNil)
  36. })
  37. }
  38. func TestDao_GetLiveAchieve(t *testing.T) {
  39. Convey("test get rc achieve", t, func() {
  40. _, err := d.GetLiveAchieve(ctx, uid)
  41. So(err, ShouldBeNil)
  42. })
  43. }
  44. func TestDao_GetLiveExp(t *testing.T) {
  45. Convey("test get exp", t, func() {
  46. expInfo, err := d.GetLiveExp(ctx, uid)
  47. So(expInfo, ShouldNotBeNil)
  48. So(err, ShouldBeNil)
  49. })
  50. }
  51. func TestDao_GetLiveVip(t *testing.T) {
  52. Convey("test get vip", t, func() {
  53. vipInfo, err := d.GetLiveVip(ctx, uid)
  54. So(vipInfo, ShouldNotBeNil)
  55. So(err, ShouldBeNil)
  56. })
  57. }
  58. func TestDao_GetLiveRank(t *testing.T) {
  59. Convey("test get rankdb", t, func() {
  60. _, err := d.GetLiveRank(ctx, uid)
  61. So(err, ShouldBeNil)
  62. })
  63. }