service_test.go 725 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package service
  2. import (
  3. "context"
  4. "flag"
  5. "testing"
  6. "time"
  7. "go-common/app/admin/main/member/conf"
  8. "github.com/smartystreets/goconvey/convey"
  9. )
  10. var s *Service
  11. func init() {
  12. flag.Parse()
  13. flag.Set("conf", "../cmd/member-admin-test.toml")
  14. if err := conf.Init(); err != nil {
  15. panic(err)
  16. }
  17. s = New(conf.Conf)
  18. }
  19. func TestPing(t *testing.T) {
  20. convey.Convey("Ping", t, func() {
  21. err := s.Ping(context.Background())
  22. convey.So(err, convey.ShouldBeNil)
  23. })
  24. }
  25. func TestFaceCheck(t *testing.T) {
  26. convey.Convey("faceCheck", t, func() {
  27. etime := time.Now().Unix()
  28. stime := time.Now().AddDate(0, 0, -2).Unix()
  29. err := s.faceAuditAI(context.Background(), stime, etime)
  30. convey.So(err, convey.ShouldBeNil)
  31. })
  32. }