예제 #1
0
func (s *varsSuite) TestJujuXDGDataHome(c *gc.C) {
	path := `/foo/bar/baz/`
	// cleanup xdg config home because it has priority and it might
	// be set on the testing env.
	s.PatchEnvironment(osenv.XDGDataHome, "")
	s.PatchEnvironment("HOME", path)
	c.Assert(osenv.JujuXDGDataHomeLinux(), gc.Equals, filepath.Join(path, ".local", "share", "juju"))
}
예제 #2
0
파일: vars_test.go 프로젝트: exekias/juju
func (s *varsSuite) TestBlankJujuXDGDataHomeEnvVar(c *gc.C) {
	s.PatchEnvironment(osenv.JujuXDGDataHomeEnvKey, "")

	if runtime.GOOS == "windows" {
		s.PatchEnvironment("APPDATA", `P:\foobar`)
	} else {
		s.PatchEnvironment("HOME", "/foobar")
	}
	c.Assert(osenv.JujuXDGDataHomeDir(), gc.Not(gc.Equals), "")

	if runtime.GOOS == "windows" {
		c.Assert(osenv.JujuXDGDataHomeDir(), gc.Equals, osenv.JujuXDGDataHomeWin())
	} else {
		c.Assert(osenv.JujuXDGDataHomeDir(), gc.Equals, osenv.JujuXDGDataHomeLinux())
	}
}
예제 #3
0
func (s *varsSuite) TestJujuXDGDataHomeNoXDGDefaultsConfig(c *gc.C) {
	s.PatchEnvironment(osenv.XDGDataHome, "")
	s.PatchEnvironment("HOME", "/a/bogus/user/home")
	homeLinux := osenv.JujuXDGDataHomeLinux()
	c.Assert(homeLinux, gc.Equals, "/a/bogus/user/home/.local/share/juju")
}
예제 #4
0
func (s *varsSuite) TestJujuXDGDataHomeXDG(c *gc.C) {
	testJujuXDGHome := "/a/bogus/home"
	s.PatchEnvironment(osenv.XDGDataHome, testJujuXDGHome)
	homeLinux := osenv.JujuXDGDataHomeLinux()
	c.Assert(homeLinux, gc.Equals, filepath.Join(testJujuXDGHome, "juju"))
}