-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
46 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,4 @@ pyvenv.cfg | |
.idea | ||
/share | ||
Pipfile* | ||
*.whl |
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,2 @@ | ||
[zest.releaser] | ||
with create-wheel = yes |
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,36 @@ | ||
import os | ||
import pytest | ||
|
||
from pathlib import Path | ||
from pcloud.api import PyCloud | ||
from pcloud.api import O_CREAT | ||
|
||
|
||
folder_for_tests = "integration-test" | ||
|
||
|
||
@pytest.fixture | ||
def pycloud_oauth2(): | ||
access_token = os.environ.get("PCLOUD_OAUTH2_TOKEN") | ||
return PyCloud("", access_token, endpoint="eapi", oauth2=True) | ||
|
||
|
||
@pytest.fixture | ||
def testfolder(pycloud_oauth2): | ||
pycloud_oauth2.createfolder(folderid=0, name=folder_for_tests) | ||
yield folder_for_tests | ||
pycloud_oauth2.deletefolderrecursive(path=f"/{folder_for_tests}") | ||
|
||
|
||
def test_upload_download_roundrobin(pycloud_oauth2, testfolder): | ||
testfile = testfile = Path(__file__).parent / "data" / "upload.txt" | ||
result = pycloud_oauth2.uploadfile(path=f"/{testfolder}", files=[testfile]) | ||
size = result["metadata"][0]["size"] | ||
assert result["result"] == 0 | ||
assert size == 14 | ||
fd = pycloud_oauth2.file_open(path=f"/{folder_for_tests}/upload.txt", flags=O_CREAT)["fd"] | ||
result = pycloud_oauth2.file_read(fd=fd, count=size) | ||
with open(testfile) as f: | ||
assert result == bytes(f.read(), "utf-8") | ||
result = pycloud_oauth2.file_close(fd=fd) | ||
assert result["result"] == 0 |