Пример #1
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_linode_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': {
                'linode': {
                    '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:
Пример #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_linode_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': {
                'linode': {
                    '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
 def setUp(self):
     super(BaseCommandTest, self).setUp()
     self.cmd = BaseCommand(self.config, self.provider, self.env)
Пример #4
0
 def setUp(self):
     super(BaseCommandTest, self).setUp()
     self.cmd = BaseCommand(self.config, self.provider, self.env)