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

Unified Diff: state/service_test.go

Issue 10172045: state: Service.SetConfigYAML
Patch Set: state: Service.SetConfigYAML Created 10 years, 9 months ago
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « state/service.go ('k') | state/statecmd/deploy_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: state/service_test.go
=== modified file 'state/service_test.go'
--- state/service_test.go 2013-06-10 21:30:13 +0000
+++ state/service_test.go 2013-06-10 22:46:06 +0000
@@ -383,31 +383,45 @@
"title": "My Title",
},
}, {
+ about: "gibberish",
+ set: serviceSetYAML("`"),
+ err: `cannot parse settings data: .*`,
+}, {
about: "bad configuration",
- set: serviceSetYAML("345"),
- err: "malformed YAML data",
+ set: serviceSetYAML("{}"),
+ err: `no settings found for "dummy-service"`,
}, {
about: "config with no options",
- set: serviceSetYAML("{}"),
+ set: serviceSetYAML("dummy-service: {}"),
expect: map[string]interface{}{},
}, {
about: "set some attributes",
initial: map[string]interface{}{
"title": "sir",
},
- set: serviceSetYAML("skill-level: 9000\nusername: admin001\n\n"),
+ set: serviceSetYAML("dummy-service:\n skill-level: 9000\n username: admin001\n\n"),
expect: map[string]interface{}{
"title": "sir",
"username": "admin001",
"skill-level": int64(9000), // yaml int types are int64
},
}, {
+ about: "remove an attribute by setting to nil",
+ initial: map[string]interface{}{
+ "title": "sir",
+ "username": "foo",
+ },
+ set: serviceSetYAML("dummy-service: {title: null}"),
+ expect: map[string]interface{}{
+ "username": "foo",
+ },
+}, {
about: "remove an attribute by setting to empty string",
initial: map[string]interface{}{
"title": "sir",
"username": "foo",
},
- set: serviceSetYAML("title: ''\n"),
+ set: serviceSetYAML("dummy-service: {title: ''}"),
expect: map[string]interface{}{
"username": "foo",
},
« no previous file with comments | « state/service.go ('k') | state/statecmd/deploy_test.go » ('j') | no next file with comments »

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