forked from mhanygin/go-gocd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroup_test.go
39 lines (36 loc) · 797 Bytes
/
group_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
package gocd
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/assert"
)
func TestGroup_Exist(t *testing.T) {
data := `{
"pipelines": [
{
"stages": [
{
"name": "up42_stage"
}
],
"name": "pp3",
"materials": [
{
"description": "URL: https://github.com/gocd/gocd, Branch: master",
"fingerprint": "2d05446cd52a998fe3afd840fc2c46b7c7e421051f0209c7f619c95bedc28b88",
"type": "Git"
}
],
"label": "${COUNT}"
}
],
"name": "second"
}`
grp := Group{}
if err := json.Unmarshal([]byte(data), &grp); err != nil {
t.Error(err)
t.Fail()
}
assert.Equal(t, grp.Exist("pp3"), true)
assert.Equal(t, grp.Exist("pp"), false)
}