def test_twine_username(): with env(secrets.TWINE_USERNAME, 'user'): token = secrets.twine_username() expected_token = 'user' assert expected_token == token
def pypi(ctx, test, repository_url): """ Sub-command for PyPI operations. """ ctx.obj.pypi = PyPI.create(repository_url=repository_url, test=test, username=secrets.twine_username(), password=secrets.twine_password())
def test_upload(pypi, pyci, mocker): mocker.patch(target='twine.commands.upload.main', new=test_utils.MagicMock()) pypi.api.upload(wheel=pyci.wheel_path) expected_args = [ '--username', secrets.twine_username(), '--password', secrets.twine_password(), '--repository-url', 'https://test.pypi.org/legacy/', pyci.wheel_path ] # noinspection PyUnresolvedReferences upload.main.assert_called_once_with(expected_args) # pylint: disable=no-member
def __init__(self): self.api = PyPI.create(username=secrets.twine_username(), password=secrets.twine_password(), test=True)
def test_twine_username_none(): with env(secrets.TWINE_USERNAME, None): with pytest.raises(ShellException): secrets.twine_username()