Ejemplo n.º 1
0
 def setUp(self):
     yield super(UnitAgentTestBase, self).setUp()
     settings = GlobalSettingsStateManager(self.client)
     yield settings.set_provider_type("dummy")
     self.change_environment(
         PATH=get_cli_environ_path(),
         JUJU_UNIT_NAME="mysql/0")
Ejemplo n.º 2
0
    def test_agent_unit_name_cli_extraction_error(self):
        """Failure to extract the unit name, results in a nice error message.
        """
        # We don't want JUJU_UNIT_NAME set, so that the expected
        # JujuError will be raised
        self.change_environment(PATH=get_cli_environ_path())
        self.change_args("unit-agent", "--juju-directory", self.makeDir(),
                         "--zookeeper-servers", get_test_zookeeper_address())

        parser = argparse.ArgumentParser()
        self.agent.setup_options(parser)
        options = parser.parse_args(namespace=TwistedOptionNamespace())

        e = self.assertRaises(JujuError, self.agent.configure, options)
        self.assertEquals(
            str(e), "--unit-name must be provided in the command line, or "
            "$JUJU_UNIT_NAME in the environment")
Ejemplo n.º 3
0
    def test_agent_unit_name_cli_extraction_error(self):
        """Failure to extract the unit name, results in a nice error message.
        """
        # We don't want JUJU_UNIT_NAME set, so that the expected
        # JujuError will be raised
        self.change_environment(
            PATH=get_cli_environ_path())
        self.change_args(
            "unit-agent",
            "--juju-directory", self.makeDir(),
            "--zookeeper-servers", get_test_zookeeper_address())

        parser = argparse.ArgumentParser()
        self.agent.setup_options(parser)
        options = parser.parse_args(namespace=TwistedOptionNamespace())

        e = self.assertRaises(JujuError,
                              self.agent.configure,
                              options)
        self.assertEquals(
            str(e),
            "--unit-name must be provided in the command line, or "
            "$JUJU_UNIT_NAME in the environment")
Ejemplo n.º 4
0
 def setUp(self):
     yield super(UnitAgentTestBase, self).setUp()
     settings = GlobalSettingsStateManager(self.client)
     yield settings.set_provider_type("dummy")
     self.change_environment(PATH=get_cli_environ_path(),
                             JUJU_UNIT_NAME="mysql/0")