-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_free_trial_numbers_test.go
72 lines (51 loc) · 1.96 KB
/
api_free_trial_numbers_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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
Messaging API v3.4.3
Testing FreeTrialNumbersAPIService
*/
package TelstraMessaging
import (
"context"
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func Test_TelstraMessaging_FreeTrialNumbersAPIService(t *testing.T) {
t.Skip("skip test")
configuration := NewConfiguration()
apiClient := NewAPIClient(configuration)
clientId := "YOUR CLIENT ID"
clientSecret := "YOUR CLIENT SECRET"
authorization, _ := GetAuthorization(apiClient, clientId, clientSecret)
t.Run("Test FreeTrialNumbersAPIService CreateTrialNumbers", func(t *testing.T) {
trialNumbers := []string{"0400000001", "0400000002"}
createTrialNumbersRequestFreeTrialNumbers := ArrayOfStringAsCreateTrialNumbersRequestFreeTrialNumbers(&trialNumbers)
createTrialNumbersRequest := NewCreateTrialNumbersRequest(createTrialNumbersRequestFreeTrialNumbers)
trialNumbersApi := apiClient.FreeTrialNumbersAPI.CreateTrialNumbers(context.Background(), authorization)
resp, httpRes, err := trialNumbersApi.CreateTrialNumbers(*createTrialNumbersRequest)
if err != nil {
fmt.Println("Error:", err)
return
}
fmt.Printf("httpRes Result: %+v\n", httpRes)
fmt.Printf("resp Result: %+v\n", resp)
fmt.Printf("resp err: %+v\n", err)
assert.Equal(t, 201, httpRes.StatusCode)
assert.NotEmpty(t, httpRes, "httpRes should not be empty")
assert.NotNil(t, resp, "resp should not be nil")
})
t.Run("Test FreeTrialNumbersAPIService GetTrialNumbers", func(t *testing.T) {
//t.Skip("skip test")
trialNumbersApi := apiClient.FreeTrialNumbersAPI.GetTrialNumbers(context.Background(), authorization)
resp, httpRes, err := trialNumbersApi.GetTrialNumbers()
if err != nil {
fmt.Println("Error:", err)
return
}
fmt.Printf("httpRes Result: %+v\n", httpRes)
fmt.Printf("resp Result: %+v\n", resp)
fmt.Printf("resp err: %+v\n", err)
assert.Equal(t, 200, httpRes.StatusCode)
assert.NotEmpty(t, httpRes, "httpRes should not be empty")
assert.NotNil(t, resp, "resp should not be nil")
})
}