1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-08-06 22:13:02 +02:00

Wrap http.Response in Response struct

The Response struct has StartAt, MaxResults and Total fields, which are
returned from JIRA API in issue search responses. They are now
accessible in Response object.
This commit is contained in:
Maciej Kwiek
2016-06-15 17:09:13 +02:00
parent 6b49178e1f
commit facc86872b
5 changed files with 83 additions and 22 deletions

View File

@ -296,3 +296,24 @@ func TestGetBaseURL_WithURL(t *testing.T) {
t.Errorf("Base URLs are not equal. Expected %+v, got %+v", *u, b)
}
}
func TestPagingInfoEmptyByDefault(t *testing.T) {
c, _ := NewClient(nil, testJIRAInstanceURL)
req, _ := c.NewRequest("GET", "/", nil)
type foo struct {
A string
}
body := new(foo)
resp, _ := c.Do(req, body)
if resp.StartAt != 0 {
t.Errorf("StartAt not equal to 0")
}
if resp.MaxResults != 0 {
t.Errorf("StartAt not equal to 0")
}
if resp.Total != 0 {
t.Errorf("StartAt not equal to 0")
}
}