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

« back to all changes in this revision

Viewing changes to environs/testing/tools.go

  • Committer: Frank Mueller
  • Date: 2014-01-21 08:46:24 UTC
  • mfrom: (2152.1.76 juju-core)
  • Revision ID: frank.mueller@canonical.com-20140121084624-rv32dv6ufzul9h1b
debugger: merged trunk and added access to debugger API facade

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
import (
7
7
        "bytes"
 
8
        "net/http"
8
9
        "os"
9
10
        "path"
10
11
        "path/filepath"
16
17
        "launchpad.net/juju-core/environs/config"
17
18
        "launchpad.net/juju-core/environs/simplestreams"
18
19
        "launchpad.net/juju-core/environs/storage"
19
 
        "launchpad.net/juju-core/environs/sync"
20
20
        envtools "launchpad.net/juju-core/environs/tools"
21
21
        "launchpad.net/juju-core/log"
22
22
        "launchpad.net/juju-core/state"
24
24
        coretools "launchpad.net/juju-core/tools"
25
25
        "launchpad.net/juju-core/version"
26
26
        "launchpad.net/juju-core/worker/upgrader"
27
 
        "net/http"
28
27
)
29
28
 
30
29
// ToolsFixture is used as a fixture to stub out the default tools URL so we
31
30
// don't hit the real internet during tests.
32
31
type ToolsFixture struct {
33
 
        origDefaultURL          string
34
 
        origDefaultSyncLocation string
35
 
        DefaultBaseURL          string
 
32
        origDefaultURL string
 
33
        DefaultBaseURL string
36
34
}
37
35
 
38
36
func (s *ToolsFixture) SetUpTest(c *gc.C) {
39
37
        s.origDefaultURL = envtools.DefaultBaseURL
40
 
        s.origDefaultSyncLocation = sync.DefaultToolsLocation
41
38
        envtools.DefaultBaseURL = s.DefaultBaseURL
42
 
        sync.DefaultToolsLocation = c.MkDir() // stop sync from going to s3
43
39
}
44
40
 
45
41
func (s *ToolsFixture) TearDownTest(c *gc.C) {
46
 
        sync.DefaultToolsLocation = sync.DefaultToolsLocation
47
42
        envtools.DefaultBaseURL = s.origDefaultURL
48
43
}
49
44