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 = [
            Droplet.from_dict(dict(id=221, name="docean-123123", ip_address="10.0.1.23")),
            Droplet.from_dict(dict(id=258, name="docena-209123", ip_address="10.0.1.103")),
        ]
        self.config.options.machines = ["1"]
        self.cmd.run()
        self.provider.terminate_instance.assert_called_once_with(221)
示例#2
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 = [
            Droplet.from_dict(
                dict(id=221, name="docean-123123", ip_address="10.0.1.23")),
            Droplet.from_dict(
                dict(id=258, name="docena-209123", ip_address="10.0.1.103"))
        ]
        self.config.options.machines = ["1"]
        self.cmd.run()
        self.provider.terminate_instance.assert_called_once_with(221)
 def setUp(self):
     super(TerminateMachineTest, self).setUp()
     self.cmd = TerminateMachine(self.config, self.provider, self.env)
示例#4
0
 def setUp(self):
     super(TerminateMachineTest, self).setUp()
     self.cmd = TerminateMachine(self.config, self.provider, self.env)