MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / TestSendCode

Function TestSendCode

internal/repository/sms_test.go:20–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18)
19
20func TestSendCode(t *testing.T) {
21 viper.Reset()
22 viper.Set("log.dir", filepath.Join(os.TempDir(), "linkme-test-logs"))
23 viper.Set("db.dsn", os.Getenv("LINKME_DB_DSN"))
24 viper.Set("redis.addr", os.Getenv("LINKME_REDIS_ADDR"))
25 viper.Set("redis.password", os.Getenv("LINKME_REDIS_PASSWORD"))
26 viper.Set("sms.provider", os.Getenv("LINKME_SMS_PROVIDER"))
27 viper.Set("sms.tencent.smsID", os.Getenv("LINKME_SMS_TENCENT_SMSID"))
28 viper.Set("sms.tencent.sign", os.Getenv("LINKME_SMS_TENCENT_SIGN"))
29 viper.Set("sms.tencent.templateID", os.Getenv("LINKME_SMS_TENCENT_TEMPLATEID"))
30 logger := ioc.InitLogger()
31 d := dao.NewSmsDAO(ioc.InitDB(), logger)
32 c := cache.NewSMSCache(ioc.InitRedis())
33 client := ioc.InitSms()
34 repo := repository.NewSmsRepository(d, c, logger, client)
35 if er := repo.SendCode(context.Background(), "xxx"); er != nil {
36 fmt.Println(er)
37 return
38 }
39}

Callers

nothing calls this directly

Calls 9

SendCodeMethod · 0.95
InitLoggerFunction · 0.92
NewSmsDAOFunction · 0.92
InitDBFunction · 0.92
NewSMSCacheFunction · 0.92
InitRedisFunction · 0.92
InitSmsFunction · 0.92
NewSmsRepositoryFunction · 0.92
SetMethod · 0.65

Tested by

no test coverage detected