-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathproblems_test.go
More file actions
38 lines (32 loc) · 782 Bytes
/
problems_test.go
File metadata and controls
38 lines (32 loc) · 782 Bytes
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
package teamcity
import (
"encoding/json"
"fmt"
"testing"
)
var JSONresponse = []byte(`{
"count": 1,
"href": "https://teamcity-or.intel.com/app/rest/problemOccurrences?locator=build:(id:431935)",
"problemOccurrence": [
{
"id": "problem:(id:135),build:(id:431935)",
"type": "TC_FAILED_TESTS",
"identity": "TC_FAILED_TESTS",
"href": "/httpAuth/app/rest/problemOccurrences/problem:(id:135),build:(id:431935)"
}
],
"default": false
}`)
func TestResponseParsing(t *testing.T) {
var v struct {
Count int64
Default bool
HREF string
ProblemOccurrence ProblemOccurrence
}
err := json.Unmarshal(JSONresponse, &v)
if err != nil {
t.Errorf("json unmarshal: %s", err)
}
fmt.Printf("%#v", v)
}