def test_upload_excp(self, mock_sftp_conn, mock_remote_path, mock_os): mock_sftp = mock.Mock() mock_transport = mock.Mock() mock_sftp.put.side_effect = ValueError() mock_sftp_conn.return_value = [mock_sftp, mock_transport] self.assertFalse( upload(mock.sentinel.config, mock.sentinel.remote_loc, mock.sentinel.u_filename)) mock_sftp_conn.assert_called_once_with(mock.sentinel.config) mock_remote_path.assert_called_once_with(mock.sentinel.remote_loc) mock_transport.close.assert_called_once_with()
def test_upload(self, mock_sftp_conn, mock_remote_path, mock_os): mock_sftp = mock.Mock() mock_transport = mock.Mock() mock_sftp_conn.return_value = [mock_sftp, mock_transport] self.assertTrue( upload(mock.sentinel.config, mock.sentinel.remote_loc, mock.sentinel.u_filename)) mock_sftp_conn.assert_called_once_with(mock.sentinel.config) mock_remote_path.assert_called_once_with(mock.sentinel.remote_loc) mock_transport.close.assert_called_once_with() self.assertEqual(mock_os.path.join.call_count, 3)
def test_upload_excp(self, mock_sftp_conn, mock_remote_path, mock_os): mock_sftp = mock.Mock() mock_transport = mock.Mock() mock_sftp.put.side_effect = ValueError() mock_sftp_conn.return_value = [mock_sftp, mock_transport] self.assertFalse(upload( mock.sentinel.config, mock.sentinel.remote_loc, mock.sentinel.u_filename )) mock_sftp_conn.assert_called_once_with(mock.sentinel.config) mock_remote_path.assert_called_once_with(mock.sentinel.remote_loc) mock_transport.close.assert_called_once_with()
def test_upload(self, mock_sftp_conn, mock_remote_path, mock_os): mock_sftp = mock.Mock() mock_transport = mock.Mock() mock_sftp_conn.return_value = [mock_sftp, mock_transport] self.assertTrue(upload( mock.sentinel.config, mock.sentinel.remote_loc, mock.sentinel.u_filename )) mock_sftp_conn.assert_called_once_with(mock.sentinel.config) mock_remote_path.assert_called_once_with(mock.sentinel.remote_loc) mock_transport.close.assert_called_once_with() self.assertEqual(mock_os.path.join.call_count, 3)