Files
iotlcm/upstream-proxy/internal/logic/upstreamimpl/mobile_public_template_test.go
T

34 lines
1.0 KiB
Go

package upstreamimpl_test
import (
"context"
"testing"
_ "git.5iot.com/iotlcm-public/iotlcm-upstream-proxy/internal/logic"
"git.5iot.com/iotlcm-public/iotlcm-upstream-proxy/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-upstream-proxy/internal/model/entity"
"git.5iot.com/iotlcm-public/iotlcm-upstream-proxy/internal/service"
)
func TestMobilePublicProxyTemplateRegistration(t *testing.T) {
for _, templateKey := range []string{
"sim_onelink_daliuliang_v1",
"sim__daliuliang_v1",
"sim_onelink_mobile_public_v1",
} {
t.Run(templateKey, func(t *testing.T) {
template, ok := service.UpstreamAPI().GetTemp(templateKey)
if !ok || template == nil {
t.Fatal("mobile public proxy template not registered")
}
config := &model.SimChannelConfigItemCache{
Template: &entity.TSimChannelTemplate{TempKey: templateKey},
Channel: &entity.TSimChannels{ChanKey: "daliuliang-test"},
}
if instance := template.NewTemp(context.Background(), config); instance == nil {
t.Fatal("mobile public proxy failed to instantiate")
}
})
}
}