LEFT | RIGHT |
(no file at all) | |
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" |
| 11 "launchpad.net/juju-core/instance" |
11 "launchpad.net/juju-core/state" | 12 "launchpad.net/juju-core/state" |
12 "launchpad.net/juju-core/state/api/params" | 13 "launchpad.net/juju-core/state/api/params" |
13 "testing" | 14 "testing" |
14 ) | 15 ) |
15 | 16 |
16 // TestPackage integrates the tests into gotest. | 17 // TestPackage integrates the tests into gotest. |
17 func TestPackage(t *testing.T) { | 18 func TestPackage(t *testing.T) { |
18 TestingT(t) | 19 TestingT(t) |
19 } | 20 } |
20 | 21 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 }, | 57 }, |
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 json: `["service","change",{"CharmURL": "cs:series/name","Name":"Benji",
"Exposed":true,"Life":"dying","Constraints":{"arch":"arm", "mem": 1024},"Config"
: {"hello":"goodbye","foo":false}}]`, |
58 }, { | 59 }, { |
59 about: "UnitInfo Delta", | 60 about: "UnitInfo Delta", |
60 value: params.Delta{ | 61 value: params.Delta{ |
61 Entity: ¶ms.UnitInfo{ | 62 Entity: ¶ms.UnitInfo{ |
62 Name: "Benji", | 63 Name: "Benji", |
63 Service: "Shazam", | 64 Service: "Shazam", |
64 Series: "precise", | 65 Series: "precise", |
65 CharmURL: "cs:~user/precise/wordpress-42", | 66 CharmURL: "cs:~user/precise/wordpress-42", |
66 » » » Ports: []params.Port{ | 67 » » » Ports: []instance.Port{ |
67 { | 68 { |
68 Protocol: "http", | 69 Protocol: "http", |
69 Number: 80}, | 70 Number: 80}, |
70 }, | 71 }, |
71 PublicAddress: "example.com", | 72 PublicAddress: "example.com", |
72 PrivateAddress: "10.0.0.1", | 73 PrivateAddress: "10.0.0.1", |
73 MachineId: "1", | 74 MachineId: "1", |
74 Status: "error", | 75 Status: "error", |
75 StatusInfo: "foo", | 76 StatusInfo: "foo", |
76 }, | 77 }, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 146 |
146 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownOperation(c *C) { | 147 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownOperation(c *C) { |
147 err := json.Unmarshal([]byte(`["relation","masticate",{}]`), new(params.
Delta)) | 148 err := json.Unmarshal([]byte(`["relation","masticate",{}]`), new(params.
Delta)) |
148 c.Check(err, ErrorMatches, `Unexpected operation "masticate"`) | 149 c.Check(err, ErrorMatches, `Unexpected operation "masticate"`) |
149 } | 150 } |
150 | 151 |
151 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownEntity(c *C) { | 152 func (s *MarshalSuite) TestDeltaMarshalJSONUnknownEntity(c *C) { |
152 err := json.Unmarshal([]byte(`["qwan","change",{}]`), new(params.Delta)) | 153 err := json.Unmarshal([]byte(`["qwan","change",{}]`), new(params.Delta)) |
153 c.Check(err, ErrorMatches, `Unexpected entity name "qwan"`) | 154 c.Check(err, ErrorMatches, `Unexpected entity name "qwan"`) |
154 } | 155 } |
LEFT | RIGHT |