~rogpeppe/juju-core/themue-058-debug-log-api

« back to all changes in this revision

Viewing changes to juju/osenv/home_test.go

  • Committer: Frank Mueller
  • Date: 2014-01-23 14:14:49 UTC
  • mfrom: (2152.1.95 juju-core)
  • Revision ID: frank.mueller@canonical.com-20140123141449-b30l57y7gs3wjkpw
debugger: merged trunk and fixed permission and interface problems

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// Copyright 2013 Canonical Ltd.
2
2
// Licensed under the AGPLv3, see LICENCE file for details.
3
3
 
4
 
package config_test
 
4
package osenv_test
5
5
 
6
6
import (
7
7
        "path/filepath"
8
8
 
9
9
        gc "launchpad.net/gocheck"
10
10
 
11
 
        "launchpad.net/juju-core/environs/config"
 
11
        "launchpad.net/juju-core/juju/osenv"
12
12
)
13
13
 
14
14
type JujuHomeSuite struct {
19
19
 
20
20
func (s *JujuHomeSuite) TestStandardHome(c *gc.C) {
21
21
        testJujuHome := c.MkDir()
22
 
        defer config.SetJujuHome(config.SetJujuHome(testJujuHome))
23
 
        c.Assert(config.JujuHome(), gc.Equals, testJujuHome)
 
22
        defer osenv.SetJujuHome(osenv.SetJujuHome(testJujuHome))
 
23
        c.Assert(osenv.JujuHome(), gc.Equals, testJujuHome)
24
24
}
25
25
 
26
26
func (s *JujuHomeSuite) TestErrorHome(c *gc.C) {
27
27
        // Invalid juju home leads to panic when retrieving.
28
 
        f := func() { _ = config.JujuHome() }
 
28
        f := func() { _ = osenv.JujuHome() }
29
29
        c.Assert(f, gc.PanicMatches, "juju home hasn't been initialized")
30
 
        f = func() { _ = config.JujuHomePath("environments.yaml") }
 
30
        f = func() { _ = osenv.JujuHomePath("environments.yaml") }
31
31
        c.Assert(f, gc.PanicMatches, "juju home hasn't been initialized")
32
32
}
33
33
 
34
34
func (s *JujuHomeSuite) TestHomePath(c *gc.C) {
35
35
        testJujuHome := c.MkDir()
36
 
        defer config.SetJujuHome(config.SetJujuHome(testJujuHome))
37
 
        envPath := config.JujuHomePath("environments.yaml")
 
36
        defer osenv.SetJujuHome(osenv.SetJujuHome(testJujuHome))
 
37
        envPath := osenv.JujuHomePath("environments.yaml")
38
38
        c.Assert(envPath, gc.Equals, filepath.Join(testJujuHome, "environments.yaml"))
39
39
}