Ejemplo n.º 1
0
def test_twine_username():

    with env(secrets.TWINE_USERNAME, 'user'):
        token = secrets.twine_username()

        expected_token = 'user'

        assert expected_token == token
Ejemplo n.º 2
0
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())
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
 def __init__(self):
     self.api = PyPI.create(username=secrets.twine_username(),
                            password=secrets.twine_password(),
                            test=True)
Ejemplo n.º 5
0
def test_twine_username_none():

    with env(secrets.TWINE_USERNAME, None):
        with pytest.raises(ShellException):
            secrets.twine_username()