~fwereade/pyjuju/go-fix-deploy-doc

« back to all changes in this revision

Viewing changes to charm/meta_test.go

  • Committer: William Reade
  • Author(s): William Reade
  • Date: 2012-06-01 07:43:36 UTC
  • mfrom: (159.3.6 go)
  • Revision ID: fwereade@gmail.com-20120601074336-q3lh83pq1x6b006k
Add local charm Repository type

R=niemeyer
CC=
https://codereview.appspot.com/6245075

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
        return bytes.NewBuffer(data)
27
27
}
28
28
 
29
 
func (s *S) TestReadMeta(c *C) {
 
29
type MetaSuite struct{}
 
30
 
 
31
var _ = Suite(&MetaSuite{})
 
32
 
 
33
func (s *MetaSuite) TestReadMeta(c *C) {
30
34
        meta, err := charm.ReadMeta(repoMeta("dummy"))
31
35
        c.Assert(err, IsNil)
32
36
        c.Assert(meta.Name, Equals, "dummy")
37
41
        c.Assert(meta.Subordinate, Equals, false)
38
42
}
39
43
 
40
 
func (s *S) TestSubordinate(c *C) {
 
44
func (s *MetaSuite) TestSubordinate(c *C) {
41
45
        meta, err := charm.ReadMeta(repoMeta("logging"))
42
46
        c.Assert(err, IsNil)
43
47
        c.Assert(meta.Subordinate, Equals, true)
44
48
}
45
49
 
46
 
func (s *S) TestSubordinateWithoutContainerRelation(c *C) {
 
50
func (s *MetaSuite) TestSubordinateWithoutContainerRelation(c *C) {
47
51
        r := repoMeta("dummy")
48
52
        hackYaml := ReadYaml(r)
49
53
        hackYaml["subordinate"] = true
51
55
        c.Assert(err, ErrorMatches, "subordinate charm \"dummy\" lacks requires relation with container scope")
52
56
}
53
57
 
54
 
func (s *S) TestScopeConstraint(c *C) {
 
58
func (s *MetaSuite) TestScopeConstraint(c *C) {
55
59
        meta, err := charm.ReadMeta(repoMeta("logging"))
56
60
        c.Assert(err, IsNil)
57
61
        c.Assert(meta.Provides["logging-client"].Scope, Equals, charm.ScopeGlobal)
59
63
        c.Assert(meta.Subordinate, Equals, true)
60
64
}
61
65
 
62
 
func (s *S) TestParseMetaRelations(c *C) {
 
66
func (s *MetaSuite) TestParseMetaRelations(c *C) {
63
67
        meta, err := charm.ReadMeta(repoMeta("mysql"))
64
68
        c.Assert(err, IsNil)
65
69
        c.Assert(meta.Provides["server"], Equals, charm.Relation{Interface: "mysql", Scope: charm.ScopeGlobal})
92
96
// This test ensures test coverage on each of these branches, along
93
97
// with ensuring the conversion object properly raises SchemaError
94
98
// exceptions on invalid data.
95
 
func (s *S) TestIfaceExpander(c *C) {
 
99
func (s *MetaSuite) TestIfaceExpander(c *C) {
96
100
        e := charm.IfaceExpander(nil)
97
101
 
98
102
        path := []string{"<pa", "th>"}