示例#1
0
class BootstrapTest(CommandBase):
    def setUp(self):
        super(BootstrapTest, self).setUp()
        self.cmd = Bootstrap(self.config, self.provider, self.env)

    @mock.patch('juju_linode.constraints.get_images')
    @mock.patch('juju_linode.ops.ssh')
    def test_bootstrap(self, mock_ssh, mock_get_images):
        mock_get_images.return_value = IMAGE_MAP
        self.setup_env()
        self.env.is_running.return_value = False
        self.config.series = "precise"

        mock_ssh.check_ssh.return_value = True
        mock_ssh.update_instance.return_value = True

        self.provider.get_instance.return_value = Linode_instace.from_dict(
            dict(id=2121, name='linode-13290123j13', ip_address="10.0.2.1"))
        self.cmd.run()

        mock_ssh.check_ssh.assert_called_once_with('10.0.2.1')
示例#2
0
 def setUp(self):
     super(BootstrapTest, self).setUp()
     self.cmd = Bootstrap(self.config, self.provider, self.env)