-
Notifications
You must be signed in to change notification settings - Fork 5
/
jira_test.go
52 lines (39 loc) · 1.11 KB
/
jira_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
package gong
import (
. "gopkg.in/check.v1"
"testing"
)
func TestJiraClient(t *testing.T) { TestingT(t) }
type JiraClientSuite struct{}
var _ = Suite(&JiraClientSuite{})
func (s *JiraClientSuite) TestBrowseWithCorrectConfig(c *C) {
config := map[string]string{
"domain": "https://fake.atlassian.net",
}
jiraClient := &JiraClient{
config: config,
}
url, err := jiraClient.Browse("feature/FAKE-1111-something-something")
c.Assert(err, Equals, nil)
c.Assert(url, Equals, "https://fake.atlassian.net/browse/FAKE-1111")
}
func (s *JiraClientSuite) TestBrowseWithIncorrectConfig(c *C) {
config := map[string]string{}
jiraClient := &JiraClient{
config: config,
}
url, err := jiraClient.Browse("feature/FAKE-1111-something-something")
c.Assert(err, NotNil)
c.Assert(url, Equals, "")
}
func (s *JiraClientSuite) TestBrowseWithCorrectConfigButIncorrectBranchName(c *C) {
config := map[string]string{
"domain": "https://fake.atlassian.net",
}
jiraClient := &JiraClient{
config: config,
}
url, err := jiraClient.Browse("feature/something-something")
c.Assert(err, NotNil)
c.Assert(url, Equals, "")
}