forked from plouc/go-jira-client
-
Notifications
You must be signed in to change notification settings - Fork 2
/
issues_test.go
56 lines (46 loc) · 1.18 KB
/
issues_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
package gojira_test
import (
"encoding/json"
. "github.com/franela/goblin"
"github.com/hekima/go-jira-client"
"testing"
)
func TestIssueCreateResponse(T *testing.T) {
var raw_rsp = []byte(`{
"id": "12345",
"key": "ASDF",
"self": "foobar"
}`)
var rsp gojira.IssueCreateResponse
err := json.Unmarshal(raw_rsp, &rsp)
g := Goblin(T)
g.Assert(err).Equal(nil)
g.Assert(rsp.Id).Equal("12345")
g.Assert(rsp.Key).Equal("ASDF")
g.Assert(rsp.Self).Equal("foobar")
}
func TestIssue(T *testing.T) {
issue := gojira.Issue{
Id: "ID",
Key: "KEY",
}
issue_json, err := json.Marshal(&issue)
g := Goblin(T)
g.Assert(err).Equal(nil)
print(string(issue_json))
// g.Assert(issue_json).Equal([]byte(`{"id":"ID","key":"KEY","self":"","expand":"","fields":null,"CreatedAt":"0001-01-01T00:00:00Z","changelog":null}`))
}
func TestIssueType(T *testing.T) {
it := gojira.IssueType{
Self: "SELF",
Id: "ID",
Description: "DESCRIPTION",
IconUrl: "ICON URL",
Name: "NAME",
Subtask: true,
}
it_json, err := json.Marshal(&it)
g := Goblin(T)
g.Assert(err).Equal(nil)
g.Assert(it_json).Equal([]byte(`{"name":"NAME","subtask":true}`))
}