elec_test.go 668 B

1234567891011121314151617181920212223242526272829303132333435
  1. package elec
  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 TestElec
  11. func TestElec(t *testing.T) {
  12. Convey("TestElec", t, func() {
  13. })
  14. err := conf.Init()
  15. if err != nil {
  16. return
  17. }
  18. dao := New(conf.Conf)
  19. elec, err := dao.Info(context.TODO(), 5461533, 15555180)
  20. if err != nil {
  21. t.Errorf("dao.Elec error(%v)", err)
  22. return
  23. }
  24. result, err := json.Marshal(elec)
  25. if err != nil {
  26. t.Errorf("json.Marshal error(%v)", elec)
  27. return
  28. }
  29. fmt.Printf("test elec (%v) \n", string(result))
  30. }