~frankban/juju-core/isolation-tests

« back to all changes in this revision

Viewing changes to utils/home_windows_test.go

  • Committer: Tarmac
  • Author(s): Francesco Banconi
  • Date: 2014-05-26 09:11:33 UTC
  • mfrom: (2784.1.11 osenv-home)
  • Revision ID: tarmac-20140526091133-circzei9ia2y4fzd
[r=frankban] Move osenv.(Set)Home functions to utils.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package osenv_test
 
1
package utils_test
2
2
 
3
3
import (
4
4
        "os"
5
5
 
6
6
        gc "launchpad.net/gocheck"
7
7
 
8
 
        "launchpad.net/juju-core/juju/osenv"
 
8
        "launchpad.net/juju-core/utils"
9
9
)
10
10
 
11
 
func (s *importSuite) TestHome(c *gc.C) {
 
11
type homeSuite struct {
 
12
        testing.CleanupSuite
 
13
}
 
14
 
 
15
var _ = gc.Suite(&homeSuite{})
 
16
 
 
17
func (s *homeSuite) TestHome(c *gc.C) {
12
18
        s.PatchEnvironment("HOMEPATH", "")
13
19
        s.PatchEnvironment("HOMEDRIVE", "")
14
20
 
15
21
        drive := "P:"
16
22
        path := `\home\foo\bar`
17
23
        h := drive + path
18
 
        osenv.SetHome(h)
 
24
        utils.SetHome(h)
19
25
        c.Check(os.Getenv("HOMEPATH"), gc.Equals, path)
20
26
        c.Check(os.Getenv("HOMEDRIVE"), gc.Equals, drive)
21
 
        c.Check(osenv.Home(), gc.Equals, h)
 
27
        c.Check(utils.Home(), gc.Equals, h)
22
28
 
23
29
        // now test that if we only set the path, we don't mess with the drive
24
30
 
25
31
        path2 := `\home\someotherfoo\bar`
26
32
 
27
 
        osenv.SetHome(path2)
 
33
        utils.SetHome(path2)
28
34
 
29
35
        c.Check(os.Getenv("HOMEPATH"), gc.Equals, path2)
30
36
        c.Check(os.Getenv("HOMEDRIVE"), gc.Equals, drive)
31
 
        c.Check(osenv.Home(), gc.Equals, drive+path2)
 
37
        c.Check(utils.Home(), gc.Equals, drive+path2)
32
38
}