class BaseCommandTest(CommandBase):

    def setUp(self):
        super(BaseCommandTest, self).setUp()
        self.cmd = BaseCommand(self.config, self.provider, self.env)

    def test_get_ssh_keys(self):
        self.provider.get_ssh_keys.return_value = [
            SSHKey.from_dict({'id': 1, 'name': 'abc'}),
            SSHKey.from_dict({'id': 32, 'name': 'bcd'})]
        self.assertEqual(
            self.cmd.get_do_ssh_keys(),
            [1, 32])

    def test_check_preconditions_okay(self):
        self.setup_env()
        self.assertEqual(self.cmd.check_preconditions(), [1])

    def test_check_preconditions_host_exist(self):
        self.setup_env({
            'environments': {
                'docean': {
                    'type': 'null',
                    'bootstrap-host': '1.1.1.1'}}})
        try:
            self.cmd.check_preconditions()
        except ConfigError, e:
            self.assertIn('already has a bootstrap-host', str(e))
        else:
Exemplo n.º 2
0
class BaseCommandTest(CommandBase):
    def setUp(self):
        super(BaseCommandTest, self).setUp()
        self.cmd = BaseCommand(self.config, self.provider, self.env)

    def test_get_ssh_keys(self):
        self.provider.get_ssh_keys.return_value = [
            SSHKey.from_dict({"id": 1, "name": "abc"}),
            SSHKey.from_dict({"id": 32, "name": "bcd"}),
        ]
        self.assertEqual(self.cmd.get_do_ssh_keys(), [1, 32])

    def test_check_preconditions_okay(self):
        self.setup_env()
        self.assertEqual(self.cmd.check_preconditions(), [1])

    def test_check_preconditions_host_exist(self):
        self.setup_env({"environments": {"docean": {"type": "null", "bootstrap-host": "1.1.1.1"}}})
        try:
            self.cmd.check_preconditions()
        except ConfigError, e:
            self.assertIn("already has a bootstrap-host", str(e))
        else:
Exemplo n.º 3
0
class BaseCommandTest(CommandBase):
    def setUp(self):
        super(BaseCommandTest, self).setUp()
        self.cmd = BaseCommand(self.config, self.provider, self.env)

    def test_get_ssh_keys(self):
        self.provider.get_ssh_keys.return_value = [
            SSHKey.from_dict({
                'id': 1,
                'name': 'abc'
            }),
            SSHKey.from_dict({
                'id': 32,
                'name': 'bcd'
            })
        ]
        self.assertEqual(self.cmd.get_do_ssh_keys(), [1, 32])

    def test_check_preconditions_okay(self):
        self.setup_env()
        self.assertEqual(self.cmd.check_preconditions(), [1])

    def test_check_preconditions_host_exist(self):
        self.setup_env({
            'environments': {
                'docean': {
                    'type': 'null',
                    'bootstrap-host': '1.1.1.1'
                }
            }
        })
        try:
            self.cmd.check_preconditions()
        except ConfigError, e:
            self.assertIn('already has a bootstrap-host', str(e))
        else:
 def setUp(self):
     super(BaseCommandTest, self).setUp()
     self.cmd = BaseCommand(self.config, self.provider, self.env)
Exemplo n.º 5
0
 def setUp(self):
     super(BaseCommandTest, self).setUp()
     self.cmd = BaseCommand(self.config, self.provider, self.env)