-
Notifications
You must be signed in to change notification settings - Fork 53
/
opsgenie_integration_test.go
57 lines (43 loc) · 1.84 KB
/
opsgenie_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
package signalfx
import (
"context"
"net/http"
"testing"
"github.com/signalfx/signalfx-go/integration"
"github.com/stretchr/testify/assert"
)
func TestCreateOpsgenieIntegration(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/v2/integration", verifyRequest(t, "POST", true, http.StatusOK, nil, "integration/create_opsgenie_success.json"))
result, err := client.CreateOpsgenieIntegration(context.Background(), &integration.OpsgenieIntegration{
Type: "Opsgenie",
})
assert.NoError(t, err, "Unexpected error creating integration")
assert.Equal(t, "string", result.Name, "Name does not match")
}
func TestGetOpsgenieIntegration(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/v2/integration/id", verifyRequest(t, "GET", true, http.StatusOK, nil, "integration/create_opsgenie_success.json"))
result, err := client.GetOpsgenieIntegration(context.Background(), "id")
assert.NoError(t, err, "Unexpected error getting integration")
assert.Equal(t, "string", result.Name, "Name does not match")
}
func TestUpdateOpsgenieIntegration(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/v2/integration/id", verifyRequest(t, "PUT", true, http.StatusOK, nil, "integration/create_opsgenie_success.json"))
result, err := client.UpdateOpsgenieIntegration(context.Background(), "id", &integration.OpsgenieIntegration{
Type: "Opsgenie",
})
assert.NoError(t, err, "Unexpected error creating integration")
assert.Equal(t, "string", result.Name, "Name does not match")
}
func TestDeleteOpsgenieIntegration(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/v2/integration/id", verifyRequest(t, "DELETE", true, http.StatusNoContent, nil, ""))
err := client.DeleteOpsgenieIntegration(context.Background(), "id")
assert.NoError(t, err, "Unexpected error creating integration")
}