func (s *OpenedResourceSuite) TestOpenResource(c *gc.C) { info, reader := newResource(c, s.stub.Stub, "spam", "some data") s.stub.ReturnGetResourceInfo = info s.stub.ReturnGetResourceData = reader opened, err := internal.OpenResource("spam", s.stub) c.Assert(err, jc.ErrorIsNil) s.stub.CheckCallNames(c, "GetResource") c.Check(opened, jc.DeepEquals, &internal.OpenedResource{ Resource: info, ReadCloser: reader, }) }
func (deps *contextDeps) OpenResource() (internal.ContextOpenedResource, error) { return internal.OpenResource(deps.name, deps) }