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

Unified Diff: cmd/juju/environment_test.go

Issue 13355044: environs/config: more restrictive New
Patch Set: environs/config: more restrictive New Created 11 years, 7 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 | « [revision details] ('k') | cmd/jujud/bootstrap.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cmd/juju/environment_test.go
=== modified file 'cmd/juju/environment_test.go'
--- cmd/juju/environment_test.go 2013-08-19 11:17:19 +0000
+++ cmd/juju/environment_test.go 2013-09-12 12:38:04 +0000
@@ -5,10 +5,13 @@
import (
"fmt"
+ "strings"
+
gc "launchpad.net/gocheck"
+
jujutesting "launchpad.net/juju-core/juju/testing"
+ "launchpad.net/juju-core/provider/dummy"
"launchpad.net/juju-core/testing"
- "strings"
)
type GetEnvironmentSuite struct {
@@ -30,7 +33,7 @@
output: "dummyenv",
}, {
key: "authorized-keys",
- output: "i-am-a-key",
+ output: dummy.SampleConfig()["authorized-keys"].(string),
}, {
key: "unknown",
err: `Key "unknown" not found in "dummyenv" environment.`,
@@ -38,7 +41,6 @@
}
func (s *GetEnvironmentSuite) TestSingleValue(c *gc.C) {
-
for _, t := range singleValueTests {
context, err := testing.RunCommand(c, &GetEnvironmentCommand{}, []string{t.key})
if t.err != "" {
@@ -57,14 +59,17 @@
}
func (s *GetEnvironmentSuite) TestAllValues(c *gc.C) {
-
context, _ := testing.RunCommand(c, &GetEnvironmentCommand{}, []string{})
output := strings.TrimSpace(testing.Stdout(context))
- // Make sure that all the environment keys are there.
- any := "(.|\n)*" // because . doesn't match new lines.
+ // Make sure that all the environment keys are there. The admin
+ // secret and CA private key are never pushed into the
+ // environment.
for key := range s.Conn.Environ.Config().AllAttrs() {
- c.Assert(output, gc.Matches, fmt.Sprintf("%s%s: %s", any, key, any))
+ c.Logf("test for key %q", key)
+ any := `(.|\n)*`
+ pattern := fmt.Sprintf(`(?m)^%s:`, key)
+ c.Check(output, gc.Matches, any+pattern+any)
}
}
@@ -106,7 +111,6 @@
}
func (s *SetEnvironmentSuite) TestInit(c *gc.C) {
-
for _, t := range setEnvInitTests {
command := &SetEnvironmentCommand{}
testing.TestInit(c, command, t.args, t.err)
« no previous file with comments | « [revision details] ('k') | cmd/jujud/bootstrap.go » ('j') | no next file with comments »

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