def test_cleanup(self, mocks): subject = TrafficSshCommands(lambda: '1.2.3.4') self.mock_executor.return_value.execute_async.return_value = 'cleaned' result = subject.cleanup(['one', 'two']) self.mock_executor.return_value.execute_async.assert_called_with([ 'ssh', '-oStrictHostKeyChecking=no', '[email protected]', 'one', 'two' ]) assert result == 'cleaned'
def __init__(self, machine_name): self.client = boto3.client('ec2', EC2_CONFIG['region']) self.ip = "" self._machine_name = machine_name self.node = Node(machine_name, NodeSshCommands(self.get_external_ip)) self.dns = Dns(machine_name, DnsSshCommands(self.get_external_ip)) self.traffic = TrafficHandler(machine_name, TrafficSshCommands(self.get_external_ip))
def __init__(self, name): self.ip_pattern = re.compile(r".*value: (.+), time.*") self.command = "VBoxManage" self.ip = "" self.name = name self.node = Node(name, NodeSshCommands(self.get_external_ip)) self.dns = Dns(name, DnsSshCommands(self.get_external_ip)) self.traffic = TrafficHandler(name, TrafficSshCommands(self.get_external_ip))
def __init__(self, machine_name, project=COMPUTE_CONFIG['project'], zone=COMPUTE_CONFIG['zone']): self.compute = googleapiclient.discovery.build('compute', 'v1') self.project = project self.zone = zone self.ip = "" self._machine_name = machine_name self.node = Node(machine_name, NodeSshCommands(self.get_external_ip)) self.dns = Dns(machine_name, DnsSshCommands(self.get_external_ip)) self.traffic = TrafficHandler(machine_name, TrafficSshCommands(self.get_external_ip))
def test_init(self, mocks): subject = TrafficSshCommands(lambda: '1.2.3.4') assert subject.get_ip() == '1.2.3.4'