本文整理汇总了Python中membase.api.rest_client.RestConnection.ldapRestOperationGetResponse方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.ldapRestOperationGetResponse方法的具体用法?Python RestConnection.ldapRestOperationGetResponse怎么用?Python RestConnection.ldapRestOperationGetResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.ldapRestOperationGetResponse方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_checkWildCard
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapRestOperationGetResponse [as 别名]
def test_checkWildCard(self):
#Create a REST connection
rest = RestConnection(self.master)
#Depending on the role specified as command line, pass parameters to the API
if (self.authRole == "fullAdmin"):
rest.ldapUserRestOperation(self.authState, self.fullAdmin, "*")
elif (self.authRole == 'roAdmin'):
rest.ldapUserRestOperation(self.authState, "*", self.ROAdmin)
elif (self.authRole == 'Both'):
rest.ldapUserRestOperation(self.authState, "*", "*")
#Get the response and then parse the JSON object and then check for multiple users
roAdmins, Admins = self._parseRestResponse(rest.ldapRestOperationGetResponse())
if (self.authRole == 'fullAdmin'):
self.assertTrue(self.validateReponse(Admins, self.fullAdmin), 'Response mismatch with expected fullAdmin - {0}'.format(self.validateReponse(Admins, self.fullAdmin)))
self.assertEqual("*", roAdmins[0], 'Validation for ROAdmins has failed: expected {0} - acutal {1}'.format("*", roAdmins))
elif (self.authRole == 'roAdmin'):
self.assertTrue(self.validateReponse(roAdmins, self.ROAdmin), 'Response mismatch with expected fullAdmin - {0}'.format(self.validateReponse(Admins, self.ROAdmin)))
self.assertEqual("*", Admins[0], 'Validation for ROAdmins has failed: expected {0} - acutal {1}'.format("*", Admins))
for user in self.fullAdmin:
status = rest.validateLogin(user[0], user[1], False)
self.assertTrue(status, 'User added as Admin has errors while login - user -- {0}'.format(user))
for user in self.ROAdmin:
status = rest.validateLogin(user[0], user[1], False)
self.assertTrue(status, 'User added as RoAdmin has errors while login - user -- {0}'.format(user))
示例2: test_addMoreMultipleAdmin
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapRestOperationGetResponse [as 别名]
def test_addMoreMultipleAdmin(self):
#Get parameters that need to be removed from the list
addUserAdmin = self.returnUserList(self.input.param("addUserAdmin", ''))
addUserROAdmin = self.returnUserList(self.input.param("addUserROAdmin", ''))
#Create a REST connection and reset LDAPSetting
rest = RestConnection(self.master)
# As per the role, add users first using API. Execute another command to remove users
# and execute API.
if (self.authRole == "fullAdmin"):
rest.ldapUserRestOperation(self.authState, adminUser=self.fullAdmin)
self.fullAdmin = self.fullAdmin + addUserAdmin
rest.ldapUserRestOperation(self.authState, adminUser=self.fullAdmin)
elif (self.authRole == 'roAdmin'):
rest.ldapUserRestOperation(self.authState, ROadminUser=self.ROAdmin)
self.ROAdmin = self.ROAdmin + addUserROAdmin
rest.ldapUserRestOperation(self.authState, ROadminUser=self.ROAdmin)
elif (self.authRole == 'Both'):
rest.ldapUserRestOperation(self.authState, self.fullAdmin, self.ROAdmin)
self.fullAdmin = self.fullAdmin + addUserAdmin
self.ROAdmin = self.ROAdmin + addUserROAdmin
rest.ldapUserRestOperation(self.authState, self.fullAdmin, self.ROAdmin)
#Get the response and validate with expected user
roAdmins, Admins = self._parseRestResponse(rest.ldapRestOperationGetResponse())
self._funcValidateResLogin(rest, self.authRole, self.authState, self.fullAdmin, self.ROAdmin, Admins, roAdmins)
示例3: test_enableDisableLdap
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapRestOperationGetResponse [as 别名]
def test_enableDisableLdap(self):
rest = RestConnection(self.master)
remote_client = RemoteMachineShellConnection(self.master)
origState = rest.ldapRestOperationGetResponse()['enabled']
cli_command = 'setting-ldap'
options = "--ldap-enable=0"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, \
options=options, cluster_host="localhost", user=self.ldapUser, password=self.ldapPass)
tempStatus = rest.ldapRestOperationGetResponse()['enabled']
self.assertFalse(tempStatus, "Issues with setting LDAP enable/disable")
cli_command = 'setting-ldap'
options = "--ldap-enable=1"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, \
options=options, cluster_host="localhost", user="Administrator", password="password")
tempStatus = rest.ldapRestOperationGetResponse()['enabled']
self.assertTrue(tempStatus, "Issues with setting LDAP enable/disable")
示例4: validateSettings
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapRestOperationGetResponse [as 别名]
def validateSettings(self, status, admin, roAdmin):
rest = RestConnection(self.master)
temproAdmins, tempAdmins = self._parseRestResponse(rest.ldapRestOperationGetResponse())
tempStatus = rest.ldapRestOperationGetResponse()['enabled']
flag = True
if (status != tempStatus):
self.log.info ("Mismatch with status - Expected - {0} -- Actual - {0}".format(status, tempStatus))
flag = False
if (tempAdmins != admin):
self.log.info ("Mismatch with Admin - Expected - {0} -- Actual - {0}".format(admin, tempAdmins))
flag = False
if (temproAdmins != roAdmin):
self.log.info ("Mismatch with roAdmin - Expected - {0} -- Actual - {0}".format(roAdmin, temproAdmins))
flag = False
return flag
示例5: test_addMultipleAdmin
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapRestOperationGetResponse [as 别名]
def test_addMultipleAdmin(self):
#Create a REST connection
rest = RestConnection(self.master)
self._setupLDAPAuth(rest, self.authRole, self.authState, self.fullAdmin, self.ROAdmin)
#Get the response and then parse the JSON object to convert it to list of users
roAdmins, Admins = self._parseRestResponse(rest.ldapRestOperationGetResponse())
#Validate the response and try to login as user added to ldapauth (Multiple verifications here)
self._funcValidateResLogin(rest, self.authRole, self.authState, self.fullAdmin, self.ROAdmin, Admins, roAdmins, self.authState)
示例6: validateSettings
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapRestOperationGetResponse [as 别名]
def validateSettings(self, status, admin, roAdmin, default):
rest = RestConnection(self.master)
temproAdmins, tempAdmins = self._parseRestResponse(rest.ldapRestOperationGetResponse())
print temproAdmins
print tempAdmins
tempStatus = rest.ldapRestOperationGetResponse()['enabled']
print rest.ldapRestOperationGetResponse()
flag = True
if (status is not self.returnBool(tempStatus)):
self.log.info ("Mismatch with status - Expected - {0} -- Actual - {1}".format(status, tempStatus))
flag = False
if (default == 'admins'):
tempAdmins = "".join(tempAdmins)
if (tempAdmins == 'asterisk'):
print "Admins is Default"
else:
print "Admin is not Default"
flag = False
else:
if (tempAdmins != admin):
self.log.info ("Mismatch with Admin - Expected - {0} -- Actual - {1}".format(admin, tempAdmins))
flag = False
if (default == 'roadmins'):
temproAdmins = "".join(temproAdmins)
if (temproAdmins == 'asterisk'):
print "Admins is Default"
else:
print "Admin is not Default"
flag = False
else:
if (temproAdmins != roAdmin):
print roAdmin
self.log.info ("Mismatch with ROAdmin - Expected - {0} -- Actual - {1}".format(roAdmin, temproAdmins))
flag = False
return flag
示例7: test_checkInvalidISASLPW
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapRestOperationGetResponse [as 别名]
def test_checkInvalidISASLPW(self):
ldapAdministrator = self.input.param("ldapAdministrator", False)
shell = RemoteMachineShellConnection(self.master)
try:
rest = RestConnection(self.master)
self._setupLDAPAuth(rest, self.authRole, self.authState, self.fullAdmin, self.ROAdmin)
roAdmins, Admins = self._parseRestResponse(rest.ldapRestOperationGetResponse())
self._funcValidateResLogin(rest, self.authRole, self.authState, self.fullAdmin, self.ROAdmin, Admins, roAdmins)
self._valAdminLogin(rest, 'Administrator', 'password', True)
command = "mv /opt/couchbase/var/lib/couchbase/isasl.pw /tmp"
o, r = shell.execute_command(command)
shell.log_command_output(o, r)
roAdmins, Admins = self._parseRestResponse(rest.ldapRestOperationGetResponse())
self._funcValidateResLogin(rest, self.authRole, self.authState, self.fullAdmin, self.ROAdmin, Admins, roAdmins)
if (ldapAdministrator):
self._valAdminLogin(rest, 'Administrator', 'password', True)
else:
self._valAdminLogin(rest, 'Administrator', 'password', False)
finally:
command = "mv /tmp/isasl.pw /opt/couchbase/var/lib/couchbase"
o, r = shell.execute_command(command)
shell.log_command_output(o, r)
shell.disconnect()
示例8: test_checkPasswordChange
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapRestOperationGetResponse [as 别名]
def test_checkPasswordChange(self):
rest = RestConnection(self.master)
self._setupLDAPAuth(rest, self.authRole, self.authState, self.fullAdmin, self.ROAdmin)
for i, j in zip(range(len(self.fullAdmin)), range(len(self.ROAdmin))):
self.fullAdmin[i][1] = 'password1'
self._changeLdapPassRemote(self.fullAdmin[i][0], 'password1')
self.ROAdmin[j][1] = 'password1'
self._changeLdapPassRemote(self.ROAdmin[j][0], 'password1')
roAdmins, Admins = self._parseRestResponse(rest.ldapRestOperationGetResponse())
self.log.info("value of roadmin and admin returned is {0} - {1}".format(roAdmins, Admins))
self.log.info("value of roadmin and admin returned is {0} - {1}".format(self.ROAdmin, self.fullAdmin))
self._funcValidateResLogin(rest, self.authRole, self.authState, self.fullAdmin, self.ROAdmin, Admins, roAdmins)
示例9: test_stopLDAPServer
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapRestOperationGetResponse [as 别名]
def test_stopLDAPServer(self):
loginState = self.input.param("loginState")
shell = RemoteMachineShellConnection(self.master)
try:
rest = RestConnection(self.master)
self._setupLDAPAuth(rest, self.authRole, self.authState, self.fullAdmin, self.ROAdmin)
#Get the response and then parse the JSON object to convert it to list of users
roAdmins, Admins = self._parseRestResponse(rest.ldapRestOperationGetResponse())
command = "service slapd stop"
o, r = shell.execute_command(command)
shell.log_command_output(o, r)
#Validate the response and try to login as user added to ldapauth (Multiple verifications here)
self._funcValidateResLogin(rest, self.authRole, self.authState, self.fullAdmin, self.ROAdmin, Admins, roAdmins, loginState)
finally:
command = "service slapd start"
o, r = shell.execute_command(command)
shell.log_command_output(o, r)
示例10: test_checkInitialState
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapRestOperationGetResponse [as 别名]
def test_checkInitialState(self):
rest = RestConnection(self.master)
content = rest.ldapRestOperationGetResponse()
self.assertEqual(content['enabled'], False)