Esempio n. 1
0
func (s *AuthKeysSuite) SetUpTest(c *gc.C) {
	s.BaseSuite.SetUpTest(c)
	old := utils.Home()
	newhome := c.MkDir()
	utils.SetHome(newhome)
	s.AddCleanup(func(*gc.C) { utils.SetHome(old) })
	s.dotssh = filepath.Join(newhome, ".ssh")
	err := os.Mkdir(s.dotssh, 0755)
	c.Assert(err, gc.IsNil)
}
Esempio n. 2
0
func (s *fakeHomeSuite) SetUpTest(c *gc.C) {
	utils.SetHome("/home/eric")
	os.Setenv("JUJU_HOME", "/home/eric/juju")
	osenv.SetJujuHome("/home/eric/juju")

	s.FakeJujuHomeSuite.SetUpTest(c)
}
Esempio n. 3
0
File: base.go Progetto: jkary/core
func (t *BaseSuite) TearDownTest(c *gc.C) {
	for name, value := range t.oldEnvironment {
		os.Setenv(name, value)
	}
	utils.SetHome(t.oldHomeEnv)
	t.LoggingSuite.TearDownTest(c)
	t.CleanupSuite.TearDownTest(c)
}
Esempio n. 4
0
File: base.go Progetto: jkary/core
func MakeFakeHome(c *gc.C) *FakeHome {
	fakeHome := c.MkDir()
	utils.SetHome(fakeHome)

	sshPath := filepath.Join(fakeHome, ".ssh")
	err := os.Mkdir(sshPath, 0777)
	c.Assert(err, gc.IsNil)
	err = ioutil.WriteFile(filepath.Join(sshPath, "id_rsa.pub"), []byte("auth key\n"), 0666)
	c.Assert(err, gc.IsNil)

	return &FakeHome{
		files: []TestFile{},
	}
}
Esempio n. 5
0
File: base.go Progetto: jkary/core
func (t *BaseSuite) SetUpTest(c *gc.C) {
	t.CleanupSuite.SetUpTest(c)
	t.LoggingSuite.SetUpTest(c)
	t.oldEnvironment = make(map[string]string)
	for _, name := range []string{
		osenv.JujuHomeEnvKey,
		osenv.JujuEnvEnvKey,
		osenv.JujuLoggingConfigEnvKey,
	} {
		t.oldEnvironment[name] = os.Getenv(name)
	}
	t.oldHomeEnv = utils.Home()
	utils.SetHome("")
	os.Setenv(osenv.JujuHomeEnvKey, "")
	os.Setenv(osenv.JujuEnvEnvKey, "")
	os.Setenv(osenv.JujuLoggingConfigEnvKey, "")
}