OLD | NEW |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 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 params_test | 4 package params_test |
5 | 5 |
6 import ( | 6 import ( |
7 "encoding/json" | 7 "encoding/json" |
8 . "launchpad.net/gocheck" | 8 . "launchpad.net/gocheck" |
9 "launchpad.net/juju-core/charm" | 9 "launchpad.net/juju-core/charm" |
10 "launchpad.net/juju-core/constraints" | 10 "launchpad.net/juju-core/constraints" |
(...skipping 30 matching lines...) Expand all Loading... |
41 json: `["machine","change",{"Id":"Benji","InstanceId":"Shazam","Status":
"error","StatusInfo":"foo"}]`, | 41 json: `["machine","change",{"Id":"Benji","InstanceId":"Shazam","Status":
"error","StatusInfo":"foo"}]`, |
42 }, { | 42 }, { |
43 about: "ServiceInfo Delta", | 43 about: "ServiceInfo Delta", |
44 value: params.Delta{ | 44 value: params.Delta{ |
45 Entity: ¶ms.ServiceInfo{ | 45 Entity: ¶ms.ServiceInfo{ |
46 Name: "Benji", | 46 Name: "Benji", |
47 Exposed: true, | 47 Exposed: true, |
48 CharmURL: "cs:series/name", | 48 CharmURL: "cs:series/name", |
49 Life: params.Life(state.Dying.String()), | 49 Life: params.Life(state.Dying.String()), |
50 Constraints: constraints.MustParse("arch=arm mem=1024M")
, | 50 Constraints: constraints.MustParse("arch=arm mem=1024M")
, |
51 » » » Config: map[string]interface{}{ | 51 » » » Config: charm.Settings{ |
52 "hello": "goodbye", | 52 "hello": "goodbye", |
53 "foo": false, | 53 "foo": false, |
54 }, | 54 }, |
55 }, | 55 }, |
56 }, | 56 }, |
57 json: `["service","change",{"CharmURL": "cs:series/name","Name":"Benji",
"Exposed":true,"Life":"dying","Constraints":{"arch":"arm", "mem": 1024},"Config"
: {"hello":"goodbye","foo":false}}]`, | 57 json: `["service","change",{"CharmURL": "cs:series/name","Name":"Benji",
"Exposed":true,"Life":"dying","Constraints":{"arch":"arm", "mem": 1024},"Config"
: {"hello":"goodbye","foo":false}}]`, |
58 }, { | 58 }, { |
59 about: "UnitInfo Delta", | 59 about: "UnitInfo Delta", |
60 value: params.Delta{ | 60 value: params.Delta{ |
61 Entity: ¶ms.UnitInfo{ | 61 Entity: ¶ms.UnitInfo{ |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownOperation(c *C) { | 146 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownOperation(c *C) { |
147 err := json.Unmarshal([]byte(`["relation","masticate",{}]`), new(params.
Delta)) | 147 err := json.Unmarshal([]byte(`["relation","masticate",{}]`), new(params.
Delta)) |
148 c.Check(err, ErrorMatches, `Unexpected operation "masticate"`) | 148 c.Check(err, ErrorMatches, `Unexpected operation "masticate"`) |
149 } | 149 } |
150 | 150 |
151 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownEntity(c *C) { | 151 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownEntity(c *C) { |
152 err := json.Unmarshal([]byte(`["qwan","change",{}]`), new(params.Delta)) | 152 err := json.Unmarshal([]byte(`["qwan","change",{}]`), new(params.Delta)) |
153 c.Check(err, ErrorMatches, `Unexpected entity name "qwan"`) | 153 c.Check(err, ErrorMatches, `Unexpected entity name "qwan"`) |
154 } | 154 } |
OLD | NEW |