logic_test.go 653 B

12345678910111213141516171819202122232425262728
  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. // TestMain defined
  16. func TestMain(m *testing.M) {
  17. conf.MustLoad(*configFile, &c)
  18. ctx = svc.NewServiceContext(c)
  19. }
  20. func TestCreateJWT(t *testing.T) {
  21. l := auth.NewLoginByWeixinLogic(context.TODO(), ctx)
  22. fmt.Println(l.CreateJWT(1624415746, c.JwtAuth.AccessSecret, nil, 1000))
  23. }