Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1118)

Side by Side Diff: state/api/params/params_test.go

Issue 10083047: state: Service ConfigSettings methods
Patch Set: state: Service ConfigSettings methods Created 10 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « state/api/client.go ('k') | state/apiserver/client.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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: &params.ServiceInfo{ 45 Entity: &params.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: &params.UnitInfo{ 61 Entity: &params.UnitInfo{
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « state/api/client.go ('k') | state/apiserver/client.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b