dao_test.go 899 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package location
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "time"
  8. "go-common/app/interface/main/app-intl/conf"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. d *Dao
  13. )
  14. func ctx() context.Context {
  15. return context.Background()
  16. }
  17. func init() {
  18. dir, _ := filepath.Abs("../../cmd/app-intl-test.toml")
  19. flag.Set("conf", dir)
  20. conf.Init()
  21. d = New(conf.Conf)
  22. time.Sleep(time.Second)
  23. }
  24. func TestInfo(t *testing.T) {
  25. Convey("get Info", t, func() {
  26. res, err := d.Info(ctx(), "127.0.0.1")
  27. So(res, ShouldNotBeEmpty)
  28. So(err, ShouldBeNil)
  29. })
  30. }
  31. func TestAuthPIDs(t *testing.T) {
  32. Convey("get AuthPIDs", t, func() {
  33. _, err := d.AuthPIDs(ctx(), "417,1521", "127.0.0.0")
  34. So(err, ShouldBeNil)
  35. })
  36. }
  37. func TestArchive(t *testing.T) {
  38. Convey("get Archive", t, func() {
  39. _, err := d.Archive(ctx(), 16816128, 16816128, "127.0.0.0", "127.0.0.0")
  40. So(err, ShouldBeNil)
  41. })
  42. }