def _test_configure_ssh_keys(self, mock_eui, exists=True): id_path = self._create_test_id() mock_client_instance = mock.Mock() if not exists: get = mock_client_instance.keypairs.get get.side_effect = exceptions.NotFound('test') undercloud._configure_ssh_keys(mock_client_instance) mock_eui.assert_called_with(id_path) mock_client_instance.keypairs.get.assert_called_with('default') if not exists: mock_client_instance.keypairs.create.assert_called_with( 'default', 'test public')
def _test_configure_ssh_keys(self, mock_eui, mock_extract, mock_client, mock_run, exists=True): id_path = self._create_test_id() mock_run.side_effect = [None, None, '3nigma'] mock_extract.side_effect = ['aturing', 'http://bletchley:5000/v2.0', 'hut8'] mock_client_instance = mock.Mock() mock_client.return_value = mock_client_instance if not exists: get = mock_client_instance.keypairs.get get.side_effect = exceptions.NotFound('test') undercloud._configure_ssh_keys() mock_eui.assert_called_with(id_path) mock_client.assert_called_with(2, 'aturing', '3nigma', 'hut8', 'http://bletchley:5000/v2.0') mock_client_instance.keypairs.get.assert_called_with('default') if not exists: mock_client_instance.keypairs.create.assert_called_with( 'default', 'test public')
def _test_configure_ssh_keys(self, mock_eui, mock_extract, mock_client, mock_run, exists=True): id_path = self._create_test_id() mock_run.side_effect = [None, None, '3nigma'] mock_extract.side_effect = [ 'aturing', 'http://bletchley:5000/v2.0', 'hut8' ] mock_client_instance = mock.Mock() mock_client.return_value = mock_client_instance if not exists: get = mock_client_instance.keypairs.get get.side_effect = exceptions.NotFound('test') undercloud._configure_ssh_keys() mock_eui.assert_called_with(id_path) mock_client.assert_called_with(2, 'aturing', '3nigma', 'hut8', 'http://bletchley:5000/v2.0') mock_client_instance.keypairs.get.assert_called_with('default') if not exists: mock_client_instance.keypairs.create.assert_called_with( 'default', 'test public')