-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_authentication_test.go
More file actions
44 lines (31 loc) · 1023 Bytes
/
api_authentication_test.go
File metadata and controls
44 lines (31 loc) · 1023 Bytes
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
/*
Messaging API v3.4.3
Testing AuthenticationAPIService
*/
package TelstraMessaging
import (
"context"
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func Test_TelstraMessaging_AuthenticationAPIService(t *testing.T) {
configuration := NewConfiguration()
apiClient := NewAPIClient(configuration)
t.Run("Test AuthenticationAPIService AuthToken", func(t *testing.T) {
t.Skip("skip test") // remove to run test
clientId := "YOUR CLIENT ID"
clientSecret := "YOUR CLIENT SECRET"
authApi := apiClient.AuthenticationAPI.AuthToken(context.Background(), clientId, clientSecret)
oauthResult, resp, err := authApi.AuthToken()
if err != nil {
fmt.Println("Error:", err)
return
}
fmt.Printf("Access Token: %s\n", *oauthResult.AccessToken)
fmt.Printf("OAuth Result: %+v\n", oauthResult)
assert.NoError(t, err, "Error encountered: %v", err)
assert.NotNil(t, resp, "Response should not be nil")
assert.NotEmpty(t, oauthResult.AccessToken, "Access token should not be empty")
})
}