func addCharm(c *gc.C, st *State, series string, ch charm.Charm) *Charm { ident := fmt.Sprintf("%s-%s-%d", series, ch.Meta().Name, ch.Revision()) curl := charm.MustParseURL("local:" + series + "/" + ident) bundleURL, err := url.Parse("http://bundles.testing.invalid/" + ident) c.Assert(err, gc.IsNil) sch, err := st.AddCharm(ch, curl, bundleURL, ident+"-sha256") c.Assert(err, gc.IsNil) return sch }
func checkDummy(c *gc.C, f charm.Charm, path string) { c.Assert(f.Revision(), gc.Equals, 1) c.Assert(f.Meta().Name, gc.Equals, "dummy") c.Assert(f.Config().Options["title"].Default, gc.Equals, "My Title") c.Assert(f.Actions(), gc.DeepEquals, &charm.Actions{ map[string]charm.ActionSpec{ "snapshot": charm.ActionSpec{ Description: "Take a snapshot of the database.", Params: map[string]interface{}{ "outfile": map[string]interface{}{ "description": "The file to write out to.", "type": "string", "default": "foo.bz2", }}}}}) switch f := f.(type) { case *charm.Bundle: c.Assert(f.Path, gc.Equals, path) case *charm.Dir: c.Assert(f.Path, gc.Equals, path) } }