forked from adlio/trello
-
Notifications
You must be signed in to change notification settings - Fork 0
/
label_test.go
42 lines (36 loc) · 920 Bytes
/
label_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
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT license.
// Details in the LICENSE file.
package trello
import (
"testing"
)
func TestGetLabel(t *testing.T) {
label := testLabel(t)
if label.Name != "Visited" {
t.Errorf("Title incorrect. Got '%s'", label.Name)
}
}
func TestGetLabelsOnBoard(t *testing.T) {
board := testBoard(t)
board.client.BaseURL = mockResponse("labels", "board-labels-api-example.json").URL
lists, err := board.GetLabels(Defaults())
if err != nil {
t.Fatal(err)
}
if len(lists) != 3 {
t.Errorf("Expected 3 labels, got %d", len(lists))
}
}
// Utility function to get the standard case Client.GetList() response
//
func testLabel(t *testing.T) *Label {
c := testClient()
c.BaseURL = mockResponse("labels", "labels-api-example.json").URL
label, err := c.GetLabel("4eea4ff", Defaults())
if err != nil {
t.Fatal(err)
}
return label
}