~rogpeppe/juju-core/438-local-instance-Addresses

« back to all changes in this revision

Viewing changes to charm/config_test.go

  • Committer: Gustavo Niemeyer
  • Date: 2011-09-24 15:21:23 UTC
  • Revision ID: gustavo@niemeyer.net-20110924152123-aytdvquwlbmnv3tj
Applied the juju/charm renaming to the Go code base.

Dropped need for the silly "header" field in metadata.yaml.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package formula_test
 
1
package charm_test
2
2
 
3
3
import (
4
4
        "bytes"
5
5
        "io"
6
6
        "io/ioutil"
7
7
        . "launchpad.net/gocheck"
8
 
        "launchpad.net/ensemble/go/formula"
 
8
        "launchpad.net/juju/go/charm"
9
9
        "os"
10
10
        "path/filepath"
11
11
)
45
45
}
46
46
 
47
47
func (s *S) TestReadConfig(c *C) {
48
 
        config, err := formula.ReadConfig(repoConfig("dummy"))
 
48
        config, err := charm.ReadConfig(repoConfig("dummy"))
49
49
        c.Assert(err, IsNil)
50
50
        c.Assert(config.Options["title"], Equals,
51
 
                formula.Option{
 
51
                charm.Option{
52
52
                        Default:     "My Title",
53
53
                        Description: "A descriptive title used for the service.",
54
54
                        Type:        "string",
57
57
}
58
58
 
59
59
func (s *S) TestConfigError(c *C) {
60
 
        _, err := formula.ReadConfig(bytes.NewBuffer([]byte(`options: {t: {type: foo}}`)))
 
60
        _, err := charm.ReadConfig(bytes.NewBuffer([]byte(`options: {t: {type: foo}}`)))
61
61
        c.Assert(err, Matches, `config: options.t.type: unsupported value`)
62
62
}
63
63
 
64
64
func (s *S) TestParseSample(c *C) {
65
 
        config, err := formula.ReadConfig(bytes.NewBuffer([]byte(sampleConfig)))
 
65
        config, err := charm.ReadConfig(bytes.NewBuffer([]byte(sampleConfig)))
66
66
        c.Assert(err, IsNil)
67
67
 
68
68
        opt := config.Options
69
69
        c.Assert(opt["title"], Equals,
70
 
                formula.Option{
 
70
                charm.Option{
71
71
                        Default:     "My Title",
72
72
                        Description: "A descriptive title used for the service.",
73
73
                        Type:        "string",
74
74
                },
75
75
        )
76
76
        c.Assert(opt["outlook"], Equals,
77
 
                formula.Option{
 
77
                charm.Option{
78
78
                        Description: "No default outlook.",
79
79
                        Type:        "string",
80
80
                },
81
81
        )
82
82
        c.Assert(opt["username"], Equals,
83
 
                formula.Option{
 
83
                charm.Option{
84
84
                        Default:     "admin001",
85
85
                        Description: "The name of the initial account (given admin permissions).",
86
86
                        Type:        "string",
87
87
                },
88
88
        )
89
89
        c.Assert(opt["skill-level"], Equals,
90
 
                formula.Option{
 
90
                charm.Option{
91
91
                        Description: "A number indicating skill.",
92
92
                        Type:        "int",
93
93
                },
95
95
}
96
96
 
97
97
func (s *S) TestValidate(c *C) {
98
 
        config, err := formula.ReadConfig(bytes.NewBuffer([]byte(sampleConfig)))
 
98
        config, err := charm.ReadConfig(bytes.NewBuffer([]byte(sampleConfig)))
99
99
        c.Assert(err, IsNil)
100
100
 
101
101
        input := map[string]string{