~rogpeppe/juju-core/azure

« back to all changes in this revision

Viewing changes to environs/local/export_test.go

  • Committer: Tarmac
  • Author(s): Tim Penhey
  • Date: 2013-07-16 22:25:44 UTC
  • mfrom: (1408.2.10 local-sudo-caller)
  • Revision ID: tarmac-20130716222544-fng1zvjpfgb46i2o
[r=thumper] Add some extra tests around the sudo checks.

Encapsulate the sudo checks, and make a function to
get the uid and gid for the user.

https://codereview.appspot.com/11321043/

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 
11
11
var Provider = provider
12
12
 
 
13
// SetRootCheckFunction allows tests to override the check for a root user.
 
14
// The return value is the function to restore the old value.
 
15
func SetRootCheckFunction(f func() bool) func() {
 
16
        old := checkIfRoot
 
17
        checkIfRoot = f
 
18
        return func() { checkIfRoot = old }
 
19
}
 
20
 
13
21
// ConfigNamespace returns the result of the namespace call on the
14
22
// localConfig.
15
23
func ConfigNamespace(cfg *config.Config) string {
35
43
                localConfig.mongoDir(),
36
44
        }
37
45
}
 
46
 
 
47
func SudoCallerIds() (uid, gid int, err error) {
 
48
        return sudoCallerIds()
 
49
}