Permalink
Browse files

Fix test suite

  • Loading branch information...
sascha-andres committed Nov 28, 2017
1 parent dcaaa48 commit ab1cee3458da903c728b62d4f9894d0b8bb8dd8a
Showing with 29 additions and 19 deletions.
  1. +29 −19 input_test.go
View
@@ -4,37 +4,47 @@ import (
"testing"
)
var demoInputOk = input{
asyncFlag: asyncFlag(false),
configPath: configPath("/demo"),
keyPath: keyPath("/demo"),
serverGroup: serverGroup("demoServerGroup"),
commandName: commandName("demo"),
verifyFlag: verifyFlag(false),
}
var (
inputCallResult *input
demoInputOk = input{
asyncFlag: asyncFlag(false),
configPath: configPath("/demo"),
keyPath: keyPath("/demo"),
serverGroup: serverGroup("demoServerGroup"),
commandName: commandName("demo"),
verifyFlag: verifyFlag(false),
}
var demoInputNotOk = input{
asyncFlag: asyncFlag(false),
configPath: configPath(""),
keyPath: keyPath(""),
serverGroup: serverGroup(""),
verifyFlag: verifyFlag(true),
demoInputNotOk = input{
asyncFlag: asyncFlag(false),
configPath: configPath(""),
keyPath: keyPath(""),
serverGroup: serverGroup(""),
verifyFlag: verifyFlag(true),
}
)
func setInputData() {
if nil == inputCallResult {
inputCallResult = getInputData()
}
}
func TestGetInputData(t *testing.T) {
getInputData()
setInputData()
}
func TestDefaultKeyPath(t *testing.T) {
inp := getInputData()
if err := inp.keyPath.validate(&demoInputOk); err != nil {
setInputData()
if err := inputCallResult.keyPath.validate(&demoInputOk); err != nil {
t.Fail()
}
}
func TestDefaultConfigPath(t *testing.T) {
inp := getInputData()
if err := inp.configPath.validate(&demoInputOk); err != nil {
setInputData()
if err := inputCallResult.configPath.validate(&demoInputOk); err != nil {
t.Fail()
}
}

0 comments on commit ab1cee3

Please sign in to comment.