瀏覽代碼

[useradmin] Modify useradmin ldap tests now that AssertionErrors are caught in the inner _import_ldap_users_info method

Jenny Kim 10 年之前
父節點
當前提交
41d8d2a
共有 2 個文件被更改,包括 6 次插入4 次删除
  1. 3 2
      apps/useradmin/src/useradmin/test_ldap.py
  2. 3 2
      apps/useradmin/src/useradmin/test_ldap_deprecated.py

+ 3 - 2
apps/useradmin/src/useradmin/test_ldap.py

@@ -548,8 +548,9 @@ def test_add_ldap_users():
 
     # Test dn with spaces in username and dn (should fail)
     response = c.post(URL, dict(server='nonsense', username_pattern='uid=user with space,ou=People,dc=example,dc=com', password1='test', password2='test', dn=True))
-    assert_true("There was a problem with some of the LDAP information" in response.content, response)
-    assert_true("Username must not contain whitespaces" in response.content, response)
+    assert_true("Could not get LDAP details for users in pattern" in response.content, response.content)
+    response = c.get(reverse(desktop.views.log_view))
+    assert_true("{username}: Username must not contain whitespaces".format(username='user with space') in response.content, response.content)
 
     # Test dn with spaces in dn, but not username (should succeed)
     response = c.post(URL, dict(server='nonsense', username_pattern='uid=user without space,ou=People,dc=example,dc=com', password1='test', password2='test', dn=True))

+ 3 - 2
apps/useradmin/src/useradmin/test_ldap_deprecated.py

@@ -505,8 +505,9 @@ def test_add_ldap_users():
 
     # Test dn with spaces in username and dn (should fail)
     response = c.post(URL, dict(username_pattern='uid=user with space,ou=People,dc=example,dc=com', password1='test', password2='test', dn=True))
-    assert_true("There was a problem with some of the LDAP information" in response.content, response)
-    assert_true("Username must not contain whitespaces" in response.content, response)
+    assert_true("Could not get LDAP details for users in pattern" in response.content, response)
+    response = c.get(reverse(desktop.views.log_view))
+    assert_true("{username}: Username must not contain whitespaces".format(username='user with space') in response.content, response.content)
 
     # Test dn with spaces in dn, but not username (should succeed)
     response = c.post(URL, dict(username_pattern='uid=user without space,ou=People,dc=example,dc=com', password1='test', password2='test', dn=True))