forked from njern/gonexmo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gonexmo_test.go
45 lines (38 loc) · 939 Bytes
/
gonexmo_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package nexmo
import (
"fmt"
"os"
"testing"
)
var (
testAPIKey string
testAPISecret string
testPhoneNumber string
testFrom string
)
func init() {
testAPIKey = os.Getenv("NEXMO_KEY")
if testAPIKey == "" {
fmt.Println("No API key specified. Please set NEXMO_KEY")
os.Exit(1)
}
testAPISecret = os.Getenv("NEXMO_SECRET")
if testAPISecret == "" {
fmt.Println("No API secret specified. Please set NEXMO_SECRET")
os.Exit(1)
}
testPhoneNumber = os.Getenv("NEXMO_NUM")
// Set a custom from value, or use the default. If you get error 15 when
// sending a message ("Illegal Sender Address - rejected") try setting this
// to your nexmo phone number.
testFrom = os.Getenv("NEXMO_FROM")
if testFrom == "" {
testFrom = "gonexmo/test"
}
}
func TestNexmoCreation(t *testing.T) {
_, err := NewClient(testAPIKey, testAPISecret)
if err != nil {
t.Error("failed to create Client with error:", err)
}
}