Files
story/internal/config/onboarding_sms_test.go
Codex Local bf1233d5df
ci / verify (push) Canceled after 0s
feat: expand companion platform, device controls, and memoir workflows
Add customer and operator login, BLE provisioning, device fleet controls, call memory, memoir generation, and refreshed family and maintenance portals. Include API contracts, migrations, firmware sources, tests, assets, and deployment documentation.
2026-10-08 10:06:44 +08:00

37 lines
1.0 KiB
Go

package config
import (
"strings"
"testing"
)
func TestTencentSMSConfigRequiresCompleteCredentialsAndApprovedTemplate(t *testing.T) {
c := OnboardingConfig{
SMSLoginEnabled: true,
SMSProvider: "tencent",
MasterKey: strings.Repeat("ab", 32),
EntryURL: "https://platform.example/onboarding/entry",
TencentSMSSecretID: "id",
TencentSMSSecretKey: "key",
TencentSMSAppID: "1400006666",
TencentSMSSignName: "安芯伴",
TencentSMSTemplateID: "123456",
}
if err := c.validate(EnvironmentProd); err != nil {
t.Fatal(err)
}
c.TencentSMSSecretKey = ""
if err := c.validate(EnvironmentProd); err == nil {
t.Fatal("Tencent SMS accepted a missing secret key")
}
c.TencentSMSSecretKey = "key"
c.TencentSMSTemplateID = "unapproved"
if err := c.validate(EnvironmentProd); err == nil {
t.Fatal("Tencent SMS accepted an invalid template ID")
}
c.SMSProvider = "unknown"
if err := c.validate(EnvironmentProd); err == nil {
t.Fatal("unknown SMS provider accepted")
}
}