Ejemplo n.º 1
0
class TerminateMachineTest(CommandBase):

    def setUp(self):
        super(TerminateMachineTest, self).setUp()
        self.cmd = TerminateMachine(self.config, self.provider, self.env)

    def test_terminate_machine(self):
        self.setup_env()
        self.env.status.return_value = {
            'machines': {
                '1': {
                    'dns-name': '10.0.1.23',
                    'instance-id': 'manual:ip_address'}
            }}
        self.provider.get_instances.return_value = [
            Instance(dict(
                id=221, hostname="slayer-123123",
                primaryIpAddress="10.0.1.23")),
            Instance(dict(
                id=258, hostname="slayer-209123",
                primaryIpAddress="10.0.1.103"))]
        self.config.options.machines = ["1"]
        self.cmd.run()
        self.provider.terminate_instance.assert_called_once_with(221)
Ejemplo n.º 2
0
 def setUp(self):
     super(TerminateMachineTest, self).setUp()
     self.cmd = TerminateMachine(self.config, self.provider, self.env)