forked from signalfx/signalfx-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jira_integration_test.go
57 lines (43 loc) · 1.78 KB
/
jira_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 TestCreateJiraIntegration(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/v2/integration", verifyRequest(t, "POST", true, http.StatusOK, nil, "integration/create_jira_success.json"))
result, err := client.CreateJiraIntegration(context.Background(), &integration.JiraIntegration{
Type: "Jira",
})
assert.NoError(t, err, "Unexpected error creating integration")
assert.Equal(t, "string", result.Name, "Name does not match")
}
func TestGetJiraIntegration(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/v2/integration/id", verifyRequest(t, "GET", true, http.StatusOK, nil, "integration/create_jira_success.json"))
result, err := client.GetJiraIntegration(context.Background(), "id")
assert.NoError(t, err, "Unexpected error getting integration")
assert.Equal(t, "string", result.Name, "Name does not match")
}
func TestUpdateJiraIntegration(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/v2/integration/id", verifyRequest(t, "PUT", true, http.StatusOK, nil, "integration/create_jira_success.json"))
result, err := client.UpdateJiraIntegration(context.Background(), "id", &integration.JiraIntegration{
Type: "Jira",
})
assert.NoError(t, err, "Unexpected error creating integration")
assert.Equal(t, "string", result.Name, "Name does not match")
}
func TestDeleteJiraIntegration(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/v2/integration/id", verifyRequest(t, "DELETE", true, http.StatusNoContent, nil, ""))
err := client.DeleteJiraIntegration(context.Background(), "id")
assert.NoError(t, err, "Unexpected error creating integration")
}