Add diff cli context tests
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user