-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgocd_test.go
42 lines (37 loc) · 1.17 KB
/
gocd_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
package gocd_test
import (
"testing"
"github.com/nikhilsbhat/gocd-sdk-go"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)
func Test_getLoglevel(t *testing.T) {
t.Run("should return warn level", func(t *testing.T) {
actual := gocd.GetLoglevel("warning")
assert.Equal(t, log.WarnLevel, actual)
})
t.Run("should return trace level", func(t *testing.T) {
actual := gocd.GetLoglevel("trace")
assert.Equal(t, log.TraceLevel, actual)
})
t.Run("should return debug level", func(t *testing.T) {
actual := gocd.GetLoglevel("debug")
assert.Equal(t, log.DebugLevel, actual)
})
t.Run("should return fatal level", func(t *testing.T) {
actual := gocd.GetLoglevel("fatal")
assert.Equal(t, log.FatalLevel, actual)
})
t.Run("should return error level", func(t *testing.T) {
actual := gocd.GetLoglevel("error")
assert.Equal(t, log.ErrorLevel, actual)
})
}
func TestGetGoCDMethodNames(t *testing.T) {
t.Run("should list all method names", func(t *testing.T) {
response := gocd.GetGoCDMethodNames()
assert.Equal(t, 131, len(response))
assert.Equal(t, "AgentKillTask", response[0])
assert.Equal(t, "ValidatePipelineSyntax", response[130])
})
}