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:
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:
示例#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)
示例#5
0
 def setUp(self):
     super(BaseCommandTest, self).setUp()
     self.cmd = BaseCommand(self.config, self.provider, self.env)