github.com/justinjmoses/evergreen@v0.0.0-20170530173719-1d50e381ff0d/cli/cli_unit_test.go (about) 1 package cli 2 3 import ( 4 "testing" 5 6 "github.com/evergreen-ci/evergreen/model" 7 . "github.com/smartystreets/goconvey/convey" 8 ) 9 10 func TestGitCmd(t *testing.T) { 11 12 Convey("when testing git cmd", t, func() { 13 14 Convey("when calling out to binary with properly formatted args should"+ 15 "run binary", func() { 16 out, err := gitCmd("--version", "") 17 So(err, ShouldBeNil) 18 19 So(out, ShouldStartWith, "git version") 20 }) 21 Convey("when calling out to binary with poorly formatted args should"+ 22 "run binary and return error", func() { 23 _, err := gitCmd("bad", "args") 24 So(err, ShouldNotBeNil) 25 So(err.Error(), ShouldEndWith, "failed with err exit status 1") 26 }) 27 28 }) 29 30 } 31 32 func TestGetHistoryCreateUrlQuery(t *testing.T) { 33 Convey("with a test history parameter", t, func() { 34 thp := model.TestHistoryParameters{ 35 Project: "sample", 36 TaskNames: []string{"a", "b"}, 37 TestNames: []string{"c", "d"}, 38 TestStatuses: []string{"blah"}, 39 TaskStatuses: []string{"one", "two"}, 40 BeforeRevision: "abc", 41 } 42 Convey("query parameter should have all relevant values", func() { 43 So(createUrlQuery(thp), ShouldEqual, 44 "testStatuses=blah&taskStatuses=one,two&tasks=a,b&tests=c,d&beforeRevision=abc") 45 }) 46 }) 47 }