-
Notifications
You must be signed in to change notification settings - Fork 51
/
azure_integration_test.go
59 lines (45 loc) · 1.93 KB
/
azure_integration_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
package signalfx
import (
"context"
"net/http"
"testing"
"github.com/signalfx/signalfx-go/integration"
"github.com/stretchr/testify/assert"
)
func TestCreateAzureIntegration(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/v2/integration", verifyRequest(t, "POST", true, http.StatusOK, nil, "integration/create_azure_success.json"))
result, err := client.CreateAzureIntegration(context.Background(), &integration.AzureIntegration{
Type: "Azure",
})
assert.NoError(t, err, "Unexpected error creating integration")
assert.Equal(t, "string", result.Name, "Name does not match")
assert.Nil(t, result.PollRate, "PollRate does not match")
assert.Equal(t, int64(120000), result.PollRateMs, "PollRateMs does not match")
}
func TestGetAzureIntegration(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/v2/integration/id", verifyRequest(t, "GET", true, http.StatusOK, nil, "integration/create_azure_success.json"))
result, err := client.GetAzureIntegration(context.Background(), "id")
assert.NoError(t, err, "Unexpected error getting integration")
assert.Equal(t, "string", result.Name, "Name does not match")
}
func TestUpdateAzureIntegration(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/v2/integration/id", verifyRequest(t, "PUT", true, http.StatusOK, nil, "integration/create_azure_success.json"))
result, err := client.UpdateAzureIntegration(context.Background(), "id", &integration.AzureIntegration{
Type: "Azure",
})
assert.NoError(t, err, "Unexpected error creating integration")
assert.Equal(t, "string", result.Name, "Name does not match")
}
func TestDeleteAzureIntegration(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/v2/integration/id", verifyRequest(t, "DELETE", true, http.StatusNoContent, nil, ""))
err := client.DeleteAzureIntegration(context.Background(), "id")
assert.NoError(t, err, "Unexpected error creating integration")
}