示例#1
0
def test_get_version_returns_install_message_when_dist_not_found(mocker):
    message = 'Please install this project with setup.py or pip'
    mocker.patch('passpie.utils.get_distribution')
    mocker.patch('passpie.utils.os.path.normcase',
                 side_effect=['path1', 'path2'])

    version = get_version()

    assert version == message
示例#2
0
def test_get_version_returns_install_message_when_dist_not_found(mocker):
    message = 'Please install this project with setup.py or pip'
    mocker.patch('passpie.utils.get_distribution')
    mocker.patch('passpie.utils.os.path.normcase',
                 side_effect=['path1', 'path2'])

    version = get_version()

    assert version == message
示例#3
0
def test_get_version_uses_get_distribution_to_find_version(mocker):
    expected_version = '1.0'
    mock_dist = mocker.patch('passpie.utils.get_distribution')()
    mock_dist.location = 'applications'
    mock_dist.version = expected_version
    mocker.patch('passpie.utils.os.path.normcase')
    mocker.patch('passpie.utils.os.path.join')

    version = get_version()

    assert version == '1.0'
示例#4
0
def test_get_version_uses_get_distribution_to_find_version(mocker):
    expected_version = '1.0'
    mock_dist = mocker.patch('passpie.utils.get_distribution')()
    mock_dist.location = 'applications'
    mock_dist.version = expected_version
    mocker.patch('passpie.utils.os.path.normcase')
    mocker.patch('passpie.utils.os.path.join')

    version = get_version()

    assert version == '1.0'