-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NXDRIVE-2711: Show that upload is still alive for very large files (#…
…4227) NXDRIVE-2711: Show thta upload is still alive for very large file Co-authored-by: swetayadav1 <[email protected]>
- Loading branch information
1 parent
b8c7a7c
commit eafde22
Showing
14 changed files
with
221 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from unittest.mock import Mock | ||
from uuid import uuid4 | ||
|
||
import pytest | ||
import requests | ||
from nuxeo.models import FileBlob | ||
|
||
from nxdrive.client.remote_client import Remote | ||
from nxdrive.client.uploader import BaseUploader | ||
|
||
|
||
@pytest.fixture | ||
def baseuploader(): | ||
remote = Remote | ||
remote.dao = Mock() | ||
return BaseUploader(remote) | ||
|
||
|
||
def test_link_blob_to_doc(baseuploader, upload, tmp_path, monkeypatch): | ||
"""Test system network and server side exception handling while linking blob to document""" | ||
file = tmp_path / f"{uuid4()}.txt" | ||
file.write_bytes(b"content") | ||
|
||
def mock_transfer_autoType_file(*args, **kwargs): | ||
raise requests.exceptions.RequestException("Connection Error") | ||
|
||
monkeypatch.setattr( | ||
baseuploader, "_transfer_autoType_file", mock_transfer_autoType_file | ||
) | ||
|
||
# server side exceptions | ||
with pytest.raises(requests.exceptions.RequestException): | ||
baseuploader.link_blob_to_doc( | ||
"Filemanager.Import", upload, FileBlob(str(file)), False | ||
) | ||
|
||
def mock_transfer_autoType_file(*args, **kwargs): | ||
raise requests.exceptions.RequestException( | ||
"TCPKeepAliveHTTPSConnectionPool: Connection Error" | ||
) | ||
|
||
monkeypatch.setattr( | ||
baseuploader, "_transfer_autoType_file", mock_transfer_autoType_file | ||
) | ||
|
||
# system network disconnect | ||
with pytest.raises(requests.exceptions.RequestException): | ||
baseuploader.link_blob_to_doc( | ||
"Filemanager.Import", upload, FileBlob(str(file)), False | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.