OLD | NEW |
1 package params_test | 1 package params_test |
2 | 2 |
3 import ( | 3 import ( |
4 "encoding/json" | 4 "encoding/json" |
5 . "launchpad.net/gocheck" | 5 . "launchpad.net/gocheck" |
6 "launchpad.net/juju-core/charm" | 6 "launchpad.net/juju-core/charm" |
7 "launchpad.net/juju-core/constraints" | 7 "launchpad.net/juju-core/constraints" |
8 "launchpad.net/juju-core/state/api/params" | 8 "launchpad.net/juju-core/state/api/params" |
9 "testing" | 9 "testing" |
10 ) | 10 ) |
(...skipping 24 matching lines...) Expand all Loading... |
35 }, | 35 }, |
36 }, | 36 }, |
37 json: `["machine","change",{"Id":"Benji","InstanceId":"Shazam","Status":
"error","StatusInfo":"foo"}]`, | 37 json: `["machine","change",{"Id":"Benji","InstanceId":"Shazam","Status":
"error","StatusInfo":"foo"}]`, |
38 }, { | 38 }, { |
39 about: "ServiceInfo Delta", | 39 about: "ServiceInfo Delta", |
40 value: params.Delta{ | 40 value: params.Delta{ |
41 Entity: ¶ms.ServiceInfo{ | 41 Entity: ¶ms.ServiceInfo{ |
42 Name: "Benji", | 42 Name: "Benji", |
43 Exposed: true, | 43 Exposed: true, |
44 CharmURL: "cs:series/name", | 44 CharmURL: "cs:series/name", |
| 45 Life: "dying", |
45 Constraints: constraints.MustParse("arch=arm mem=1024M")
, | 46 Constraints: constraints.MustParse("arch=arm mem=1024M")
, |
46 Config: map[string]interface{}{ | 47 Config: map[string]interface{}{ |
47 "hello": "goodbye", | 48 "hello": "goodbye", |
48 "foo": false, | 49 "foo": false, |
49 }, | 50 }, |
50 }, | 51 }, |
51 }, | 52 }, |
52 » json: `["service","change",{"CharmURL": "cs:series/name","Name":"Benji",
"Exposed":true,"Constraints":{"arch":"arm", "mem": 1024},"Config": {"hello":"goo
dbye","foo":false}}]`, | 53 » json: `["service","change",{"CharmURL": "cs:series/name","Name":"Benji",
"Exposed":true,"Life":"dying","Constraints":{"arch":"arm", "mem": 1024},"Config"
: {"hello":"goodbye","foo":false}}]`, |
53 }, { | 54 }, { |
54 about: "UnitInfo Delta", | 55 about: "UnitInfo Delta", |
55 value: params.Delta{ | 56 value: params.Delta{ |
56 Entity: ¶ms.UnitInfo{ | 57 Entity: ¶ms.UnitInfo{ |
57 Name: "Benji", | 58 Name: "Benji", |
58 Service: "Shazam", | 59 Service: "Shazam", |
59 Series: "precise", | 60 Series: "precise", |
60 CharmURL: "cs:~user/precise/wordpress-42", | 61 CharmURL: "cs:~user/precise/wordpress-42", |
61 Ports: []params.Port{ | 62 Ports: []params.Port{ |
62 params.Port{ | 63 params.Port{ |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 141 |
141 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownOperation(c *C) { | 142 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownOperation(c *C) { |
142 err := json.Unmarshal([]byte(`["relation","masticate",{}]`), new(params.
Delta)) | 143 err := json.Unmarshal([]byte(`["relation","masticate",{}]`), new(params.
Delta)) |
143 c.Check(err, ErrorMatches, `Unexpected operation "masticate"`) | 144 c.Check(err, ErrorMatches, `Unexpected operation "masticate"`) |
144 } | 145 } |
145 | 146 |
146 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownEntity(c *C) { | 147 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownEntity(c *C) { |
147 err := json.Unmarshal([]byte(`["qwan","change",{}]`), new(params.Delta)) | 148 err := json.Unmarshal([]byte(`["qwan","change",{}]`), new(params.Delta)) |
148 c.Check(err, ErrorMatches, `Unexpected entity name "qwan"`) | 149 c.Check(err, ErrorMatches, `Unexpected entity name "qwan"`) |
149 } | 150 } |
OLD | NEW |