Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 // Copyright 2012, 2013 Canonical Ltd. | 1 // Copyright 2012, 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package main | 4 package main |
5 | 5 |
6 import ( | 6 import ( |
7 "bytes" | 7 "bytes" |
8 » "os" | 8 » "io/ioutil" |
9 | 9 |
10 . "launchpad.net/gocheck" | 10 . "launchpad.net/gocheck" |
11 "launchpad.net/goyaml" | 11 "launchpad.net/goyaml" |
12 "launchpad.net/juju-core/cmd" | 12 "launchpad.net/juju-core/cmd" |
13 "launchpad.net/juju-core/juju/testing" | 13 "launchpad.net/juju-core/juju/testing" |
14 coretesting "launchpad.net/juju-core/testing" | 14 coretesting "launchpad.net/juju-core/testing" |
15 ) | 15 ) |
16 | 16 |
17 // juju get and set tests (because one needs the other) | 17 // juju get and set tests (because one needs the other) |
18 | 18 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 c.Check(code, Equals, 0) | 149 c.Check(code, Equals, 0) |
150 cfg, err := svc.Config() | 150 cfg, err := svc.Config() |
151 c.Assert(err, IsNil) | 151 c.Assert(err, IsNil) |
152 c.Assert(cfg.Map(), DeepEquals, t.expect) | 152 c.Assert(cfg.Map(), DeepEquals, t.expect) |
153 } | 153 } |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 func setupConfigfile(c *C, dir string) string { | 157 func setupConfigfile(c *C, dir string) string { |
158 ctx := coretesting.ContextForDir(c, dir) | 158 ctx := coretesting.ContextForDir(c, dir) |
159 path := ctx.AbsPath("testconfig.yaml") | 159 path := ctx.AbsPath("testconfig.yaml") |
rog
2013/06/11 12:21:01
err := ioutil.WriteFile(
ctx.AbsPath("testconf
fwereade
2013/06/12 01:00:59
Why not indeed. Done.
| |
160 » file, err := os.Create(path) | 160 » content := []byte("dummy-service:\n skill-level: 9000\n username: admi n001\n\n") |
161 » c.Assert(err, IsNil) | 161 » err := ioutil.WriteFile(path, content, 0666) |
162 » defer file.Close() | |
163 » _, err = file.Write([]byte("dummy-service:\n skill-level: 9000\n usern ame: admin001\n\n")) | |
164 c.Assert(err, IsNil) | 162 c.Assert(err, IsNil) |
165 return path | 163 return path |
166 } | 164 } |
LEFT | RIGHT |