예제 #1
0
    def test_loader_retrieve_provider(self):
        providers = ["juju.providers.dummy.MachineProvider",
                     "juju.providers.ec2.MachineProvider"]

        for provider_name in providers:
            provider = get_callable(provider_name)
            self.assertEqual(provider.__name__, "MachineProvider")
            self.assertTrue(callable(provider))
예제 #2
0
    def test_loader_retrieve_provider(self):
        providers = [
            "juju.providers.dummy.MachineProvider",
            "juju.providers.ec2.MachineProvider"
        ]

        for provider_name in providers:
            provider = get_callable(provider_name)
            self.assertEqual(provider.__name__, "MachineProvider")
            self.assertTrue(callable(provider))
예제 #3
0
    def get_machine_provider(self):
        """Return a MachineProvider instance for the given provider name.

        The returned instance will be retrieved from the module named
        after the type of the given machine provider.
        """
        if self._machine_provider is None:
            provider_type = self._environment_config["type"]
            MachineProvider = get_callable(
                "juju.providers.%s.MachineProvider" % provider_type)
            self._machine_provider = MachineProvider(
                self._name, self._environment_config)
        return self._machine_provider
예제 #4
0
    def get_machine_provider(self):
        """Return a MachineProvider instance for the given provider name.

        The returned instance will be retrieved from the module named
        after the type of the given machine provider.
        """
        if self._machine_provider is None:
            provider_type = self._environment_config["type"]
            MachineProvider = get_callable(
                "juju.providers.%s.MachineProvider" % provider_type)
            self._machine_provider = MachineProvider(self._name,
                                                     self._environment_config)
        return self._machine_provider
예제 #5
0
 def test_loader_valid_specification(self):
     split = get_callable("os.path.split")
     assert callable(split)
     assert split("foo/bar") == ("foo", "bar")
예제 #6
0
 def test_loader_valid_specification(self):
     split = get_callable("os.path.split")
     assert callable(split)
     assert split("foo/bar") == ("foo", "bar")