def test_get_ip_address_string(self): expected_result = '10.200.30.165' with mock.patch('ae_preflight.profile.execute_command') as cmd: cmd.return_value = command_returns.ip_addr_show().decode('utf-8') ip_address = profile.get_interface_ip_address('eth0', False) self.assertEquals(expected_result, ip_address, 'Did not get the expected IP address')
def test_get_ip_address_bad_interface(self): expected_result = None with mock.patch('ae_preflight.profile.execute_command') as cmd: cmd.return_value = ( command_returns.ip_addr_show_no_ip().decode('utf-8')) ip_address = profile.get_interface_ip_address( 'enP33102p0s2', False) self.assertEquals(expected_result, ip_address, 'Did not get the expected IP address')