Merge pull request #317 from fkautz/pr_out_adding_test_function_for_getting_config_file

This commit is contained in:
Frederick F. Kautz IV
2015-04-10 18:42:21 -07:00
2 changed files with 23 additions and 0 deletions
+1
View File
@@ -58,6 +58,7 @@ func mustGetMcBashCompletionFilename() string {
}
// NewClient - get new client
// TODO refactor this to be more testable
func getNewClient(debug bool, urlStr string) (clnt client.Client, err error) {
hostCfg, err := getHostConfig(urlStr)
if err != nil {
+22
View File
@@ -0,0 +1,22 @@
package main
import (
. "github.com/minio-io/check"
"os/user"
"path"
"runtime"
)
func (s *MySuite) TestGetMcConfigDir(c *C) {
u, err := user.Current()
c.Assert(err, IsNil)
dir, err := getMcConfigDir()
c.Assert(err, IsNil)
if runtime.GOOS == "linux" {
c.Assert(dir, Equals, path.Join(u.HomeDir, ".mc/"))
} else if runtime.GOOS == "windows" {
c.Assert(dir, Equals, path.Join(u.HomeDir, "mc/"))
} else {
c.Fail()
}
}