-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add `batch_upload_to_pypi` to `reserver_obj.py` * add `test_batch_packages_names` testcase * `CHANGELOG.md` updated * apply renamings * `CHANGELOG.md` updated * update testcases * enhance `batch_upload` functionality * `CHANGELOG.md` updated * enhance `batch_upload` testcase
- Loading branch information
Showing
4 changed files
with
40 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Reserver modules.""" | ||
from .reserver_param import RESERVER_VERSION | ||
from .reserver_obj import Uploader | ||
from .reserver_obj import PyPIUploader | ||
|
||
__version__ = RESERVER_VERSION |
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 |
---|---|---|
@@ -1,21 +1,26 @@ | ||
from reserver import Uploader | ||
from reserver import PyPIUploader | ||
from reserver.reserver_func import get_random_name | ||
import os | ||
test_pypi_token = os.environ.get("TEST_PYPI_PASSWORD") | ||
|
||
def test_package_exists(): | ||
# test reserved name | ||
uploader = Uploader(test_pypi_token, test_pypi= True) | ||
assert uploader.upload_to_pypi("numpy") == False | ||
uploader = PyPIUploader(test_pypi_token, test_pypi= True) | ||
assert uploader.upload("numpy") == False | ||
|
||
def test_batch_packages_names(): | ||
# test batch of package names | ||
uploader = PyPIUploader(test_pypi_token, test_pypi= True) | ||
assert uploader.batch_upload("numpy", "scikit-learn") == 0 | ||
|
||
def test_valid_package_invalid_credentials(): | ||
# test not reserved name -> wrong credentials | ||
wrong_pypi_token = "pypi-wrong-api-token" | ||
uploader = Uploader(wrong_pypi_token, test_pypi= True) | ||
assert uploader.upload_to_pypi(get_random_name()) == False | ||
uploader = PyPIUploader(wrong_pypi_token, test_pypi= True) | ||
assert uploader.upload(get_random_name()) == False | ||
|
||
def test_valid_package_valid_credentials(): | ||
# test not reserved name -> correct credentials | ||
# uploader = Uploader(test_pypi_token, test_pypi= True) | ||
# uploader = PyPIUploader(test_pypi_token, test_pypi= True) | ||
# uploader.upload_to_pypi(get_random_name()) | ||
assert True == True |