-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathuserfeedback_test.go
63 lines (48 loc) · 1.38 KB
/
userfeedback_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
package sentry
import (
"testing"
)
func TestUserFeedbackResource(t *testing.T) {
client := newTestClient(t)
org, err := client.GetOrganization(getDefaultOrg())
if err != nil {
t.Fatal(err)
}
team, cleanup := createTeamHelper(t)
project, cleanupproj := createProjectHelper(t, team)
defer cleanupproj()
defer cleanup()
createMessagesHelper(t, client, org, project, 10)
t.Run("Submit user feedback with a issue", func(t *testing.T) {
issues, _, _ := client.GetIssues(org, project, nil, nil, nil)
if len(issues) == 0 {
t.Fatal("No issues found.")
}
issue := issues[0]
events, _, _ := client.GetIssueEvents(issue)
if len(events) == 0 {
t.Fatal("no events found")
}
feedback := NewUserFeedback("Colin Wood", "This is a great feature", "cwood@testing.com", events[0].EventID)
err := client.SubmitUserFeedback(org, project, &feedback)
if err != nil {
t.Error(err)
}
if feedback.DateCreated == nil {
t.Error("Date created didnt get updated when posted to the backend")
}
t.Run("Fetch all feedback for this project", func(t *testing.T) {
feedbacks, link, err := client.GetProjectUserFeedback(org, project)
if err != nil {
t.Error(err)
} else {
if len(feedbacks) == 0 {
t.Error("Should at least be one feedback for this project")
}
if link.Next.Results {
t.Error("Should only be one page of results")
}
}
})
})
}