mirror of
https://github.com/hanzozt/zt.git
synced 2026-10-30 15:04:55 +00:00
- Repo names: ziti-* → zt-* - Go modules: github.com/hanzozt/ziti → github.com/hanzozt/zt - Docker images: hanzozt/ziti-* → hanzozt/zt-* - C/Java/JS symbols: ziti_* → zt_* - File and directory names updated
38 lines
1000 B
Go
38 lines
1000 B
Go
package tests
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hanzozt/sdk-golang/zt"
|
|
"github.com/hanzozt/zt/v2/common/eid"
|
|
)
|
|
|
|
func Test_SDK_API_Session_Token_Update(t *testing.T) {
|
|
ctx := NewTestContext(t)
|
|
defer ctx.Teardown()
|
|
ctx.StartServer()
|
|
ctx.RequireAdminManagementApiLogin()
|
|
ctx.CreateEnrollAndStartEdgeRouter()
|
|
|
|
ctx.AdminManagementSession.requireNewEdgeRouterPolicy(s("#all"), s("#all"))
|
|
ctx.AdminManagementSession.requireNewServiceEdgeRouterPolicy(s("#all"), s("#all"))
|
|
|
|
sdkRole := eid.New()
|
|
_, hostContextIface := ctx.AdminManagementSession.RequireCreateSdkContext(sdkRole)
|
|
defer hostContextIface.Close()
|
|
|
|
sdkContext, ok := hostContextIface.(*zt.ContextImpl)
|
|
ctx.Req.True(ok, "sdkContext should be of type *zt.ContextImpl")
|
|
ctx.Req.NotNil(sdkContext)
|
|
|
|
err := sdkContext.Authenticate()
|
|
ctx.Req.NoError(err)
|
|
|
|
err = sdkContext.ConnectAllAvailableErs()
|
|
ctx.Req.NoError(err)
|
|
|
|
functionalErr, erErr := sdkContext.RefreshApiSession()
|
|
ctx.Req.NoError(functionalErr)
|
|
ctx.Req.NoError(erErr)
|
|
}
|