github.com/goplus/yap@v0.8.1/ytest/demo/jwtdemo/gop_autogen_test.go (about) 1 // Code generated by gop (Go+); DO NOT EDIT. 2 3 package main 4 5 import ( 6 "github.com/goplus/yap/ytest" 7 "github.com/goplus/yap/ytest/auth/jwt" 8 "github.com/qiniu/x/stringutil" 9 "testing" 10 "time" 11 ) 12 13 type case_jwtdemo struct { 14 ytest.CaseApp 15 } 16 //line ytest/demo/jwtdemo/jwtdemo_ytest.gox:7 17 func (this *case_jwtdemo) Main() { 18 //line ytest/demo/jwtdemo/jwtdemo_ytest.gox:7:1 19 this.Mock("foo.com", new(AppV2)) 20 //line ytest/demo/jwtdemo/jwtdemo_ytest.gox:9:1 21 testuser := jwt.HS256("<secret key>").Audience("testuser").Expiration(time.Now().Add(time.Hour)) 22 //line ytest/demo/jwtdemo/jwtdemo_ytest.gox:11:1 23 id := "123" 24 //line ytest/demo/jwtdemo/jwtdemo_ytest.gox:12:1 25 this.Get(stringutil.Concat("http://foo.com/p/", id)) 26 //line ytest/demo/jwtdemo/jwtdemo_ytest.gox:13:1 27 this.Auth(testuser) 28 //line ytest/demo/jwtdemo/jwtdemo_ytest.gox:14:1 29 this.RetWith(200) 30 //line ytest/demo/jwtdemo/jwtdemo_ytest.gox:15:1 31 this.Json(map[string]string{"id": id}) 32 } 33 func (this *case_jwtdemo) Classfname() string { 34 return "jwtdemo" 35 } 36 func Test_jwtdemo(t *testing.T) { 37 ytest.Gopt_CaseApp_TestMain(new(case_jwtdemo), t) 38 }