logic_test.go 633 B

123456789101112131415161718192021222324252627
  1. package user
  2. import (
  3. "context"
  4. "flag"
  5. "fmt"
  6. "testing"
  7. "git.i2edu.net/i2/go-zero/core/conf"
  8. "git.i2edu.net/i2/i2-bill-api/internal/config"
  9. "git.i2edu.net/i2/i2-bill-api/internal/logic/auth"
  10. "git.i2edu.net/i2/i2-bill-api/internal/svc"
  11. )
  12. var configFile = flag.String("f", "etc/i2bill-api.yaml", "the config file")
  13. var c config.Config
  14. var ctx *svc.ServiceContext
  15. func TestMain(m *testing.M) {
  16. conf.MustLoad(*configFile, &c)
  17. ctx = svc.NewServiceContext(c)
  18. }
  19. func TestCreateJWT(t *testing.T) {
  20. l := auth.NewLoginByWeixinLogic(context.TODO(), ctx)
  21. fmt.Println(l.CreateJWT(1624415746, c.JwtAuth.AccessSecret, nil, 1000))
  22. }