Add diff cli context tests

This commit is contained in:
Harshavardhana
2015-07-24 16:30:43 -07:00
parent 2a6cced987
commit cd1f80c442
2 changed files with 17 additions and 10 deletions
+17
View File
@@ -23,6 +23,7 @@ import (
"path/filepath"
"strconv"
"github.com/minio/mc/pkg/console"
. "gopkg.in/check.v1"
)
@@ -85,3 +86,19 @@ func (s *CmdTestSuite) TestDiffDirs(c *C) {
c.Assert(len(diff.message), Equals, 0)
}
}
func (s *CmdTestSuite) TestDiffContext(c *C) {
err := app.Run([]string{os.Args[0], "diff", server.URL + "/bucket", server.URL + "/bucket"})
c.Assert(err, IsNil)
c.Assert(console.IsExited, Equals, false)
err = app.Run([]string{os.Args[0], "diff", server.URL + "/bucket...", server.URL + "/bucket"})
c.Assert(err, IsNil)
c.Assert(console.IsExited, Equals, false)
err = app.Run([]string{os.Args[0], "diff", server.URL + "/invalid", server.URL + "/invalid..."})
c.Assert(err, IsNil)
c.Assert(console.IsExited, Equals, true)
// reset back
console.IsExited = false
}
-10
View File
@@ -20,7 +20,6 @@ import (
"path/filepath"
"github.com/minio/mc/pkg/client"
"github.com/minio/mc/pkg/console"
"github.com/minio/minio/pkg/iodine"
)
@@ -62,12 +61,3 @@ func getHostConfig(URL string) (*hostConfig, error) {
}
return nil, NewIodine(iodine.New(errNoMatchingHost{}, nil))
}
// mustGetHostConfig retrieves host specific configuration such as access keys, exits upon error
func mustGetHostConfig(URL string) *hostConfig {
hostCfg, err := getHostConfig(URL)
if err != nil {
console.Fatalf("Unable to retrieve host configuration. %s\n", NewIodine(iodine.New(err, nil)))
}
return hostCfg
}