|
|
@@ -12,11 +12,17 @@ import (
|
|
|
"git.i2edu.net/i2/i2-bill-api/internal/svc"
|
|
|
)
|
|
|
|
|
|
-func TestCreateJWT(t *testing.T) {
|
|
|
- var configFile = flag.String("f", "etc/i2bill-api.yaml", "the config file")
|
|
|
- var c config.Config
|
|
|
+var configFile = flag.String("f", "etc/i2bill-api.yaml", "the config file")
|
|
|
+var c config.Config
|
|
|
+var ctx *svc.ServiceContext
|
|
|
+
|
|
|
+// TestMain defined
|
|
|
+func TestMain(m *testing.M) {
|
|
|
conf.MustLoad(*configFile, &c)
|
|
|
- ctx := svc.NewServiceContext(c)
|
|
|
+ ctx = svc.NewServiceContext(c)
|
|
|
+}
|
|
|
+
|
|
|
+func TestCreateJWT(t *testing.T) {
|
|
|
l := auth.NewLoginByWeixinLogic(context.TODO(), ctx)
|
|
|
fmt.Println(l.CreateJWT(1624415746, c.JwtAuth.AccessSecret, nil, 1000))
|
|
|
}
|