Ejemplo n.º 1
0
func (s *configSuite) SetUpTest(c *gc.C) {
	s.BaseSuite.SetUpTest(c)
	mockCapabilities := func(*gomaasapi.MAASObject, string) (set.Strings, error) {
		return set.NewStrings("network-deployment-ubuntu"), nil
	}
	s.PatchValue(&GetCapabilities, mockCapabilities)
	mockGetController := func(string, string) (gomaasapi.Controller, error) {
		return nil, gomaasapi.NewUnsupportedVersionError("oops")
	}
	s.PatchValue(&GetMAAS2Controller, mockGetController)
}
Ejemplo n.º 2
0
func (s *environSuite) SetUpTest(c *gc.C) {
	s.BaseSuite.SetUpTest(c)
	s.ToolsFixture.SetUpTest(c)

	mockCapabilities := func(client *gomaasapi.MAASObject) (set.Strings, error) {
		return set.NewStrings("network-deployment-ubuntu"), nil
	}
	mockGetController := func(maasServer, apiKey string) (gomaasapi.Controller, error) {
		return nil, gomaasapi.NewUnsupportedVersionError("oops")
	}
	s.PatchValue(&maas.GetCapabilities, mockCapabilities)
	s.PatchValue(&maas.GetMAAS2Controller, mockGetController)
}
Ejemplo n.º 3
0
func (s *providerSuite) SetUpTest(c *gc.C) {
	s.baseProviderSuite.SetUpTest(c)
	mockCapabilities := func(*gomaasapi.MAASObject, string) (set.Strings, error) {
		return set.NewStrings("network-deployment-ubuntu"), nil
	}
	mockGetController := func(string, string) (gomaasapi.Controller, error) {
		return nil, gomaasapi.NewUnsupportedVersionError("oops")
	}
	s.PatchValue(&GetCapabilities, mockCapabilities)
	s.PatchValue(&GetMAAS2Controller, mockGetController)
	// Creating a space ensures that the spaces endpoint won't 404.
	s.testMAASObject.TestServer.NewSpace(spaceJSON(gomaasapi.CreateSpace{Name: "space-0"}))
}