def test__prepare_auth_v2():
    # Test for :func:`zpmlib.zpm._prepare_auth`, with version 2.0
    version = '2.0'
    args = mock.Mock()
    args.os_auth_url = 'http://example.com:5000/v2.0'
    args.os_username = 'user1'
    args.os_tenant_name = 'tenant1'
    args.os_password = 'secret'
    conn = None

    expected = {
        'version': '2.0',
        'authUrl': 'http://example.com:5000/v2.0',
        'tenant': 'tenant1',
        'username': 'user1',
        'password': 'secret',
    }
    assert zpm._prepare_auth(version, args, conn) == expected
    # Make sure that we're robust enough to handle slightly varied version
    # inputs.
    version = '2'
    assert zpm._prepare_auth(version, args, conn) == expected