You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
205 lines
3.9 KiB
205 lines
3.9 KiB
2 months ago
|
package sms
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"github.com/go-kratos/kratos/v2/log"
|
||
|
"reflect"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestALiYunCase_RunSendSms(t *testing.T) {
|
||
|
type fields struct {
|
||
|
aly ALiYunRepo
|
||
|
log *log.Helper
|
||
|
}
|
||
|
type args struct {
|
||
|
ctx context.Context
|
||
|
phoneNumber string
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
fields fields
|
||
|
args args
|
||
|
want string
|
||
|
wantErr bool
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
al := &ALiYunCase{
|
||
|
aly: tt.fields.aly,
|
||
|
log: tt.fields.log,
|
||
|
}
|
||
|
got, err := al.RunSendSms(tt.args.ctx, tt.args.phoneNumber)
|
||
|
if (err != nil) != tt.wantErr {
|
||
|
t.Errorf("RunSendSms() error = %v, wantErr %v", err, tt.wantErr)
|
||
|
return
|
||
|
}
|
||
|
if got != tt.want {
|
||
|
t.Errorf("RunSendSms() got = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestCreateRandCode(t *testing.T) {
|
||
|
type args struct {
|
||
|
ctx context.Context
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
want string
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
if got := CreateRandCode(tt.args.ctx); got != tt.want {
|
||
|
t.Errorf("CreateRandCode() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestCreateRandCodeFrom(t *testing.T) {
|
||
|
type args struct {
|
||
|
ctx context.Context
|
||
|
n int
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
want string
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
if got := CreateRandCodeFrom(tt.args.ctx, tt.args.n); got != tt.want {
|
||
|
t.Errorf("CreateRandCodeFrom() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestNewMsgSend(t *testing.T) {
|
||
|
type args struct {
|
||
|
ur ALiYunRepo
|
||
|
logger log.Logger
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
want *ALiYunCase
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
if got := NewMsgSend(tt.args.ur, tt.args.logger); !reflect.DeepEqual(got, tt.want) {
|
||
|
t.Errorf("NewMsgSend() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestALiYunCase_RunSendSms1(t *testing.T) {
|
||
|
type fields struct {
|
||
|
aly ALiYunRepo
|
||
|
log *log.Helper
|
||
|
}
|
||
|
type args struct {
|
||
|
ctx context.Context
|
||
|
phoneNumber string
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
fields fields
|
||
|
args args
|
||
|
want string
|
||
|
wantErr bool
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
al := &ALiYunCase{
|
||
|
aly: tt.fields.aly,
|
||
|
log: tt.fields.log,
|
||
|
}
|
||
|
got, err := al.RunSendSms(tt.args.ctx, tt.args.phoneNumber)
|
||
|
if (err != nil) != tt.wantErr {
|
||
|
t.Errorf("RunSendSms() error = %v, wantErr %v", err, tt.wantErr)
|
||
|
return
|
||
|
}
|
||
|
if got != tt.want {
|
||
|
t.Errorf("RunSendSms() got = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestCreateRandCode1(t *testing.T) {
|
||
|
type args struct {
|
||
|
ctx context.Context
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
want string
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
if got := CreateRandCode(tt.args.ctx); got != tt.want {
|
||
|
t.Errorf("CreateRandCode() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestCreateRandCodeFrom1(t *testing.T) {
|
||
|
type args struct {
|
||
|
ctx context.Context
|
||
|
n int
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
want string
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
if got := CreateRandCodeFrom(tt.args.ctx, tt.args.n); got != tt.want {
|
||
|
t.Errorf("CreateRandCodeFrom() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestNewMsgSend1(t *testing.T) {
|
||
|
type args struct {
|
||
|
ur ALiYunRepo
|
||
|
logger log.Logger
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
want *ALiYunCase
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
if got := NewMsgSend(tt.args.ur, tt.args.logger); !reflect.DeepEqual(got, tt.want) {
|
||
|
t.Errorf("NewMsgSend() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|