HUE-8053 Fix unit test

Review Request #12634 - Created March 12, 2018 and submitted

Ying Chen
hue
master
HUE-8053
hue
enricoberti, jgauthier, johan, ranade, romain, test, weixia
commit 8637cd66d34b65da6e2c9d4135f2a59b4c667162 (HEAD -> HUE-8053-ldap, origin/HUE-8053-ldap)
Author: Ying Chen <yingchen@cloudera.com>
Date:   Mon Mar 12 13:46:01 2018 -0700

    HUE-8053 Fix unit test

:100644 100644 a04aba7740... ff5046227c... M    apps/useradmin/src/useradmin/middleware.py
:100644 100644 1f4b4bd0da... 17cdc5a582... M    apps/useradmin/src/useradmin/test_ldap.py
Hue-Build-Master/312/ Test is OK
  • 0
  • 0
  • 2
  • 2
  • 4
Description From Last Updated
  1. Better commit name possible?

  2. apps/useradmin/src/useradmin/middleware.py (Diff revision 1)
     
     
     
     
     

    Isn't the actual problem that we don't test for server is none anymore?

    https://github.com/cloudera/hue/commit/68b323cd9f231503ebf8a0e18e6361c421ad1154#diff-12034cc3e0f599671e419a13a820aca7R902

    Seems like multi LDAP support for LdapSynchronization is not properly implemented yet?

    1. So far, I had seen two use cases for _import_ldap_users_info()
      
      1. When hue.ini has sync_groups_on_login=true, and 'server' also get value, so ldap_config = desktop.conf.LDAP.LDAP_SERVERS.get()[server] is ok
      2. Run "Sync LDAP users and groups" as superuser from user, it will come to https://github.com/cloudera/hue/blob/68b323cd9f231503ebf8a0e18e6361c421ad1154/apps/useradmin/src/useradmin/views.py#L736.
         In this case, sync_groups is False and server is None, so ldap_config = desktop.conf.LDAP.LDAP_SERVERS.get()[server] is ok
         and it also will separately called groups = sync_ldap_groups(connection, failed_users=failed_users)
      3. Unit test from test_ldap.py, which trigger the call to useradmin.middleware.LdapSynchronizationMiddleware
      
      I think that we just need to fix the case #3.
  3. We never do this in the non test world? Why would it be test specific?

    1. The useradmin.middleware.LdapSynchronizationMiddleware is only getting called by: 
      
      https://github.com/cloudera/hue/blob/68b323cd9f231503ebf8a0e18e6361c421ad1154/apps/useradmin/src/useradmin/test_ldap.py#L53
  4. Better name possible?

  5. 
      
  1. 
      
  2. Add note?: Used by tests only

  3. 
      
Review request changed

Status: Closed (submitted)

Loading...