Esempio n. 1
0
func (s *toolsSuite) TestFindToolsNotFound(c *gc.C) {
	s.PatchValue(common.EnvtoolsFindTools, func(g environs.ConfigGetter, major, minor int, filter coretools.Filter, allowRetry bool) (list coretools.List, err error) {
		return nil, errors.NotFoundf("tools")
	})
	result, err := common.FindTools(s.State, params.FindToolsParams{})
	c.Assert(err, gc.IsNil)
	c.Assert(result.Error, jc.Satisfies, params.IsCodeNotFound)
}
Esempio n. 2
0
func (s *toolsSuite) TestFindTools(c *gc.C) {
	list := coretools.List{&coretools.Tools{Version: version.Current}}
	s.PatchValue(common.EnvtoolsFindTools, func(g environs.ConfigGetter, major, minor int, filter coretools.Filter, allowRetry bool) (coretools.List, error) {
		c.Assert(major, gc.Equals, 123)
		c.Assert(minor, gc.Equals, 456)
		c.Assert(filter.Number, gc.Equals, version.Current.Number)
		c.Assert(filter.Series, gc.Equals, "win81")
		c.Assert(filter.Arch, gc.Equals, "alpha")
		return list, nil
	})
	result, err := common.FindTools(s.State, params.FindToolsParams{
		Number:       version.Current.Number,
		MajorVersion: 123,
		MinorVersion: 456,
		Series:       "win81",
		Arch:         "alpha",
	})
	c.Assert(err, gc.IsNil)
	c.Assert(result.List, gc.DeepEquals, list)
}
Esempio n. 3
0
// FindTools returns a List containing all tools matching the given parameters.
func (c *Client) FindTools(args params.FindToolsParams) (params.FindToolsResult, error) {
	return common.FindTools(c.api.state, args)
}
Esempio n. 4
0
// FindTools returns a List containing all tools matching the given parameters.
func (p *ProvisionerAPI) FindTools(args params.FindToolsParams) (params.FindToolsResult, error) {
	return common.FindTools(p.st, args)
}