73 lines
1.3 KiB
Go
73 lines
1.3 KiB
Go
package sigmasms
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
func loadToken(t *testing.T) string {
|
|
data, err := os.ReadFile("./token.test")
|
|
if err != nil {
|
|
t.Fatalf("test token load error: %v", err)
|
|
}
|
|
return string(data)
|
|
}
|
|
|
|
func TestFlashCall(t *testing.T) {
|
|
token := loadToken(t)
|
|
code, _ := GenerateFreshcCallCode()
|
|
log.Println(code)
|
|
FlashCall(token, "+79857770038", "NG.Market", code)
|
|
}
|
|
|
|
func TestFlashCallWait(t *testing.T) {
|
|
token := loadToken(t)
|
|
code, _ := GenerateFreshcCallCode()
|
|
log.Println(code)
|
|
trID, err := FlashCallWait(token, "+79857770038", "NG.Market", code)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(trID)
|
|
}
|
|
|
|
func TestSMS(t *testing.T) {
|
|
token := loadToken(t)
|
|
SendSMS(
|
|
token,
|
|
"+79857770038",
|
|
"NG.Market",
|
|
"Привет",
|
|
)
|
|
}
|
|
|
|
func TestSMSWait(t *testing.T) {
|
|
token := loadToken(t)
|
|
trID, err := SendSMSWait(token, "+79857770038", "NG.Market", "Привет из Москвы :)")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(trID)
|
|
}
|
|
|
|
func TestStatus(t *testing.T) {
|
|
token := loadToken(t)
|
|
id, _ := uuid.Parse("518095e8-a62d-4af1-ad1f-2a56e955cf55")
|
|
status, err := RequestStatus(id, token)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(status)
|
|
}
|
|
|
|
func TestFreshCallCode(t *testing.T) {
|
|
code, err := GenerateFreshcCallCode()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(code)
|
|
}
|