OLD | NEW |
1 package server_test | 1 package server_test |
2 | 2 |
3 import ( | 3 import ( |
4 "fmt" | 4 "fmt" |
5 "io/ioutil" | 5 "io/ioutil" |
6 . "launchpad.net/gocheck" | 6 . "launchpad.net/gocheck" |
7 "launchpad.net/juju-core/charm" | 7 "launchpad.net/juju-core/charm" |
8 "launchpad.net/juju-core/cmd/jujuc/server" | 8 "launchpad.net/juju-core/cmd/jujuc/server" |
9 "launchpad.net/juju-core/state" | 9 "launchpad.net/juju-core/state" |
10 "launchpad.net/juju-core/state/testing" | 10 "launchpad.net/juju-core/state/testing" |
11 "os" | 11 "os" |
12 "path/filepath" | 12 "path/filepath" |
13 "strings" | 13 "strings" |
14 ) | 14 ) |
15 | 15 |
16 type GetCommandSuite struct { | 16 type GetCommandSuite struct { |
17 HookContextSuite | 17 HookContextSuite |
18 } | 18 } |
19 | 19 |
20 var _ = Suite(&GetCommandSuite{}) | 20 var _ = Suite(&GetCommandSuite{}) |
21 | 21 |
22 var getCommandTests = []struct { | 22 var getCommandTests = []struct { |
23 name string | 23 name string |
24 err string | 24 err string |
25 }{ | 25 }{ |
26 {"close-port", ""}, | 26 {"close-port", ""}, |
27 {"config-get", ""}, | 27 {"config-get", ""}, |
28 {"juju-log", ""}, | 28 {"juju-log", ""}, |
29 {"open-port", ""}, | 29 {"open-port", ""}, |
| 30 {"relation-set", ""}, |
30 {"unit-get", ""}, | 31 {"unit-get", ""}, |
31 {"random", "unknown command: random"}, | 32 {"random", "unknown command: random"}, |
32 } | 33 } |
33 | 34 |
34 func (s *GetCommandSuite) TestGetCommand(c *C) { | 35 func (s *GetCommandSuite) TestGetCommand(c *C) { |
35 ctx := s.GetHookContext(c, 0, "") | 36 ctx := s.GetHookContext(c, 0, "") |
36 for _, t := range getCommandTests { | 37 for _, t := range getCommandTests { |
37 com, err := ctx.NewCommand(t.name) | 38 com, err := ctx.NewCommand(t.name) |
38 if t.err == "" { | 39 if t.err == "" { |
39 // At this level, just check basic sanity; commands are
tested in | 40 // At this level, just check basic sanity; commands are
tested in |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 expect["change"] = "exciting" | 411 expect["change"] = "exciting" |
411 node, err = ctx.Settings() | 412 node, err = ctx.Settings() |
412 c.Assert(err, IsNil) | 413 c.Assert(err, IsNil) |
413 c.Assert(node.Map(), DeepEquals, expect) | 414 c.Assert(node.Map(), DeepEquals, expect) |
414 | 415 |
415 // ...and was written to state. | 416 // ...and was written to state. |
416 settings, err = s.ru.ReadSettings("u/0") | 417 settings, err = s.ru.ReadSettings("u/0") |
417 c.Assert(err, IsNil) | 418 c.Assert(err, IsNil) |
418 c.Assert(settings, DeepEquals, expect) | 419 c.Assert(settings, DeepEquals, expect) |
419 } | 420 } |
OLD | NEW |