Changeset - e0735ea41d8d
[Not reviewed]
default
0 1 0
Mads Kiilerich - 9 years ago 2016-06-29 16:52:07
madski@unity3d.com
tests: fix Python 2.6 compatibility in string formatting

Python 2.6 would fail with:
ValueError: zero length field name in format
1 file changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/other/test_auth_ldap.py
Show inline comments
 
@@ -30,17 +30,17 @@ def test_update_user_attributes_from_lda
 
                                          arrange_ldap_auth):
 
    """Authenticate user with mocked LDAP, verify attributes are updated.
 
    """
 

	
 
    # Arrange test user.
 
    uniqifier = uuid.uuid4()
 
    username = 'test-user-{}'.format(uniqifier)
 
    username = 'test-user-{0}'.format(uniqifier)
 
    assert User.get_by_username(username) is None
 
    user_input = dict(username='test-user-{}'.format(uniqifier),
 
    user_input = dict(username='test-user-{0}'.format(uniqifier),
 
                      password='spam password',
 
                      email='spam-email-{}'.format(uniqifier),
 
                      email='spam-email-{0}'.format(uniqifier),
 
                      firstname='spam first name',
 
                      lastname='spam last name',
 
                      active=True,
 
                      admin=False)
 
    user = create_test_user(user_input)
 

	
 
@@ -67,13 +67,13 @@ def test_update_user_attributes_from_lda
 
def test_init_user_attributes_from_ldap(monkeypatch, arrange_ldap_auth):
 
    """Authenticate unknown user with mocked LDAP, verify user is created.
 
    """
 

	
 
    # Arrange test user.
 
    uniqifier = uuid.uuid4()
 
    username = 'test-user-{}'.format(uniqifier)
 
    username = 'test-user-{0}'.format(uniqifier)
 
    assert User.get_by_username(username) is None
 

	
 
    # Arrange LDAP auth.
 
    monkeypatch.setattr(auth_ldap, 'AuthLdap', _AuthLdapMock)
 

	
 
    # Authenticate with LDAP.
 
@@ -110,13 +110,13 @@ def test_init_user_attributes_from_ldap_
 
                                                           arrange_ldap_auth):
 
    """Authenticate unknown user with mocked LDAP where email is missing.
 
    """
 

	
 
    # Arrange test user.
 
    uniqifier = uuid.uuid4()
 
    username = 'test-user-{}'.format(uniqifier)
 
    username = 'test-user-{0}'.format(uniqifier)
 
    assert User.get_by_username(username) is None
 

	
 
    # Arrange LDAP auth.
 
    monkeypatch.setattr(auth_ldap, 'AuthLdap', _AuthLdapNoEmailMock)
 

	
 
    # Authenticate with LDAP.
0 comments (0 inline, 0 general)