account_test.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package account
  2. import (
  3. "context"
  4. "encoding/json"
  5. "fmt"
  6. "testing"
  7. "go-common/app/interface/main/app-interface/conf"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. //go test -conf="../../app-interface-example.toml" -v -test.run TestCard
  11. func TestCard(t *testing.T) {
  12. Convey("TestCard", t, func() {
  13. err := conf.Init()
  14. if err != nil {
  15. return
  16. }
  17. dao := New(conf.Conf)
  18. card, err := dao.Profile3(context.TODO(), 28009145)
  19. if err != nil {
  20. t.Errorf("dao.Profile3 error(%v)", err)
  21. return
  22. }
  23. result, err := json.Marshal(card)
  24. if err != nil {
  25. t.Errorf("json.Marshal error(%v)", err)
  26. return
  27. }
  28. fmt.Printf("test card (%v) \n", string(result))
  29. })
  30. }
  31. //go test -conf="../../app-interface-example.toml" -v -test.run TestCardByName
  32. func TestCardByName(t *testing.T) {
  33. err := conf.Init()
  34. if err != nil {
  35. return
  36. }
  37. dao := New(conf.Conf)
  38. card, err := dao.ProfileByName3(context.TODO(), "冠冠爱看书")
  39. if err != nil {
  40. t.Errorf("dao.ProfileByName3 error(%v)", err)
  41. return
  42. }
  43. result, err := json.Marshal(card)
  44. if err != nil {
  45. t.Errorf("json.Marshal error(%v)", err)
  46. return
  47. }
  48. fmt.Printf("test card (%v) \n", string(result))
  49. }