DESCRIPTION

Adding more test cases for LDAP, refactored code in rest_client.py. There is still some work pending for having LDAP config in ini file and dynamic adding of LDAP users.
Change-Id: I6e1f95de75cc7ad35a8b759fe45750c917cd3404


COMMENTS

author: Ean Andrews
date: 2015-01-09 03:53:40.044000000

Uploaded patch set 5.

-------------------------------------
author: Hugo Blankenship
date: 2015-01-09 03:53:46.783000000

Patch Set 5:

Build Started http://factory.couchbase.com/job/testrunner-Jasmin Rangel-master/3691/

-------------------------------------
author: Hugo Blankenship
date: 2015-01-09 04:08:20.812000000

Patch Set 5: Verified+1

Build Successful 

http://factory.couchbase.com/job/testrunner-Jasmin Rangel-master/3691/ : SUCCESS

-------------------------------------
author: Fisher Vargas
date: 2015-01-09 04:49:09.677000000

Patch Set 5:

(12 comments)

Line:22, pytests/security/ldaptest.py -> Remove this spaces in red.

Line:91, pytests/security/ldaptest.py -> There is no additional need for tearDown e.g. remove ldap settings etc.?

Line:167, pytests/security/ldaptest.py -> We can use assertFalse or assertTrue accordingly.

Line:278, pytests/security/ldaptest.py -> Please use "message" in each assert statement(s).

Line:324, pytests/security/ldaptest.py -> self.assertTrue(self._validateMultipleUser(Admins,self.userlistMultipleAdmin))

Line:350, pytests/security/ldaptest.py -> same as above.

Line:563, pytests/security/ldaptest.py -> Please move this function above. I mean before tests start.

Line:575, pytests/security/ldaptest.py -> remove red spaces.

Line:598, pytests/security/ldaptest.py -> use enumerate() function instead of range(len()).

for i, currentString in enumerate(splitString):
   ...
   ...

Line:2451, lib/membase/api/rest_client.py -> Can we list "Admin" in testConstants.py? If test or other files going to use it.

Line:2470, lib/membase/api/rest_client.py -> There is no need of assigment i.e. self.authOperation, self.currAdmins, ... self.__ variables. Directly use function arguments for further processing.

Line:2517, lib/membase/api/rest_client.py -> No need of this else. by default function returns None.

-------------------------------------
author: Ean Andrews
date: 2015-01-09 06:24:49.903000000

Patch Set 5:

(9 comments)

Comments from Sangarsh are merged. There are 2 comments I did not change:
a) Message for each assert. I will do that in my next check-in
b) Moving functions above tests. I agree to this 100% and will do that in next check-in

Line:22, pytests/security/ldaptest.py -> Done

Line:91, pytests/security/ldaptest.py -> Not now. Since the OS has to be pre-configured for LDAP to work. I have all my machines pre-configured with LDAP and these set of machines are dedicated to running these tests.

Line:167, pytests/security/ldaptest.py -> I can do this in next check-in.

Line:278, pytests/security/ldaptest.py -> This will be next check-in Sangharsh. I will make a bulk change for that.

Line:324, pytests/security/ldaptest.py -> I do this for more readability. Let me make this change in next patch.

Line:598, pytests/security/ldaptest.py -> I need to check this Sangarsh. I wanted to use enumerate, but the string becomes a little hard for me to handle. May be I can try in next check-in I do.

Line:2451, lib/membase/api/rest_client.py -> Okay. Other tests will not be using the Admins for now. These are users specific for LDAP tests, and these have to exist in LDAP before the test runs.

Line:2470, lib/membase/api/rest_client.py -> Updated in next patch set

Line:2517, lib/membase/api/rest_client.py -> Done. I have update it in next patch set.

-------------------------------------
author: Ean Andrews
date: 2015-01-09 06:29:10.064000000

Patch Set 5:

(2 comments)

Updated comments.

Line:324, pytests/security/ldaptest.py -> Done checkin

Line:350, pytests/security/ldaptest.py -> Done

-------------------------------------
author: Trevor Santana
date: 2015-01-09 06:47:24.103000000

Patch Set 5:

(7 comments)

Line:22, conf/security/py-ldap.conf -> skip_rebalance option is not needed here, it is always skipped unless nodes_init is provided
why do you skip_cleanup?

Line:138, pytests/security/ldaptest.py -> delete whitespaces

Line:187, pytests/security/ldaptest.py -> extra whitespaces

Line:328, pytests/security/ldaptest.py -> what i was asking is about Sangharsh's comment, why you are using if-else

Line:619, pytests/security/ldaptest.py -> extra whitespaces

Line:2495, lib/membase/api/rest_client.py -> self._http_request(api, 'POST', params=params, headers=header)
will do exactly you are doing

Line:2500, lib/membase/api/rest_client.py -> return (status ['status'] == "400" and login == False)

-------------------------------------
author: Ean Andrews
date: 2015-01-09 07:01:00.673000000

Patch Set 5:

(6 comments)

Line:22, conf/security/py-ldap.conf -> there is basically nothing to cleanup since I only login to the nodes. There is no bucket creation etc...
I will remove skip_rebalance in next patch set.

Line:138, pytests/security/ldaptest.py -> Removed all whitespaces.

Line:187, pytests/security/ldaptest.py -> Done

Line:619, pytests/security/ldaptest.py -> Done

Line:2495, lib/membase/api/rest_client.py -> I had tried that Trevor Santana before i moved to using bare function. I will try it offline in my next check-in. I have used self.__http_request everywhere except this one. I guess the headers are creating issues. But I will try once again for my next check-in

Line:2500, lib/membase/api/rest_client.py -> I really want a 400 response and want to make sure that login failure is expected. If there is any other response type then I wanted to return FAIL. Not sure how the API shapes up in future.

-------------------------------------
