当前位置: 首页>>代码示例>>Python>>正文


Python RestConnection.ldapUserRestOperation方法代码示例

本文整理汇总了Python中membase.api.rest_client.RestConnection.ldapUserRestOperation方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.ldapUserRestOperation方法的具体用法?Python RestConnection.ldapUserRestOperation怎么用?Python RestConnection.ldapUserRestOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在membase.api.rest_client.RestConnection的用法示例。


在下文中一共展示了RestConnection.ldapUserRestOperation方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_addLdapAdminRO

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapUserRestOperation [as 别名]
    def test_addLdapAdminRO(self):
        ops = self.input.param("ops", None)
        role = self.input.param("role", None)
        adminUser = self.input.param('adminUser', None)
        roAdminUser = self.input.param('roAdminUser', None)
        default = self.input.param('default', None)
        source = 'ns_server'
        rest = RestConnection(self.master)
        user = self.master.rest_username

        #User must be pre-created in LDAP in advance
        if (ops in ['ldapAdmin']) and (default is not None):
            rest.ldapUserRestOperation(True, adminUser=[[adminUser]], exclude='roAdmin')
            expectedResults = {"ro_admins":'default', "admins":[adminUser], "enabled":True, "source":source, \
                                   "user":user, "ip":self.ipAddress, "port":57457, 'sessionid':''}
        elif (ops in ['ldapROAdmin']) and (default is not None):
            rest.ldapUserRestOperation(True, ROadminUser=[[roAdminUser]], exclude='fullAdmin')
            expectedResults = {"admins":'default', "ro_admins":[roAdminUser], "enabled":True, "source":source, \
                                   "user":user, "ip":self.ipAddress, "port":57457, 'sessionid':''}
        elif (ops in ['ldapAdmin']):
            rest.ldapUserRestOperation(True, adminUser=[[adminUser]], exclude=None)
            expectedResults = {"ro_admins":[], "admins":[adminUser], "enabled":True, "source":source, \
                                   "user":user, "ip":self.ipAddress, "port":57457, 'sessionid':''}
        elif (ops in ['ldapROAdmin']):
            rest.ldapUserRestOperation(True, ROadminUser=[[roAdminUser]], exclude=None)
            expectedResults = {"admins":[], "ro_admins":[roAdminUser], "enabled":True, "source":source, \
                                   "user":user, "ip":self.ipAddress, "port":57457, 'sessionid':''}
        elif (ops in ['Both']):
            rest.ldapUserRestOperation(True, ROadminUser=[[roAdminUser]], adminUser=[[adminUser]], exclude=None)
            expectedResults = {"admins":[adminUser], "ro_admins":[roAdminUser], "enabled":True, "source":source, \
                                   "user":user, "ip":self.ipAddress, "port":57457, 'sessionid':''}

        self.checkConfig(self.eventID, self.master, expectedResults)
开发者ID:pkdevboxy,项目名称:testrunner,代码行数:35,代码来源:audittest.py

示例2: setUp

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapUserRestOperation [as 别名]
 def setUp(self):
     super(ldapCLITest, self).setUp()
     self.enableStatus = self.input.param("enableStatus", None)
     self.admin = self.returnUserList(self.input.param("admin", None))
     self.roAdmin = self.returnUserList(self.input.param("roAdmin", None))
     self.errorMsg = self.input.param("errorMsg", None)
     self.default = self.input.param("default", None)
     self.ldapUser = self.input.param('ldapUser', 'Administrator')
     self.ldapPass = self.input.param('ldapPass', 'password')
     self.source = self.input.param('source', None)
     if (self.source == 'saslauthd'):
         rest = RestConnection(self.master)
         rest.ldapUserRestOperation(True, [[self.ldapUser]], exclude=None)
开发者ID:EricACooper,项目名称:testrunner,代码行数:15,代码来源:ldaptest.py

示例3: setUp

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapUserRestOperation [as 别名]
 def setUp(self):
     super(auditCLITest, self).setUp()
     self.enableStatus = self.input.param("enableStatus", None)
     self.logPath = self.input.param("logPath", None)
     self.rotateInt = self.input.param("rotateInt", None)
     self.errorMsg = self.input.param("errorMsg", None)
     self.ldapUser = self.input.param('ldapUser', 'Administrator')
     self.ldapPass = self.input.param('ldapPass', 'password')
     self.source = self.input.param('source', None)
     self.shell = RemoteMachineShellConnection(self.master)
     info = self.shell.extract_remote_info()
     type = info.type.lower()
     if type == 'windows' and self.source == 'saslauthd':
         raise Exception(" Ldap Tests cannot run on windows");
     else:
         if self.source == 'saslauthd':
             rest = RestConnection(self.master)
             rest.ldapUserRestOperation(True, [[self.ldapUser]], exclude=None)
开发者ID:pkdevboxy,项目名称:testrunner,代码行数:20,代码来源:auditcheckconfig.py

示例4: test_loginEvents

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapUserRestOperation [as 别名]
    def test_loginEvents(self):
        ops = self.input.param("ops", None)
        role = self.input.param("role", None)
        username = self.input.param('username', None)
        password = self.input.param('password', None)
        source = 'ns_server'
        rest = RestConnection(self.master)
        user = self.master.rest_username

        if (ops in ['loginRoAdmin', 'deleteuser', 'passwordChange']):
                rest.create_ro_user(username, password)

        if (ops in ['loginAdmin', 'loginRoAdmin']):
            status, content = rest.validateLogin(username, password, True, getContent=True)
            sessionID = (((status['set-cookie']).split("="))[1]).split(";")[0]
            expectedResults = {'source':source, 'user':username, 'password':password, 'role':role, 'ip':self.ipAddress, "port":123456, 'sessionid':sessionID}

        elif (ops in ['deleteuser']):
            expectedResults = {"role":role, "real_userid:source":source, 'real_userid:user':user,
                               'ip':self.ipAddress, "port":123456, 'userid':username}
            rest.delete_ro_user()

        elif (ops in ['passwordChange']):
            expectedResults = {'real_userid:source':source, 'real_userid:user':user,
                               'password':password, 'role':role, 'ip':self.ipAddress, "port":123456,
                               'userid':username}
            rest.changePass_ro_user(username, password)

        elif (ops in ['invalidlogin']):
            status, content = rest.validateLogin(username, password, True, getContent=True)
            expectedResults = {'real_userid':username, 'password':password, 'role':role,
                               'ip':self.ipAddress, "port":123456}

        #User must be pre-created in LDAP in advance
        elif (ops in ['ldapLogin']):
            rest = RestConnection(self.master)
            rest.ldapUserRestOperation(True, [[username]], exclude=None)
            status, content = rest.validateLogin(username, password, True, getContent=True)
            sessionID = (((status['set-cookie']).split("="))[1]).split(";")[0]
            expectedResults = {'source':'saslauthd', 'user':username, 'password':password, 'role':role, 'ip':self.ipAddress, "port":123456, 'sessionid':sessionID}

        self.checkConfig(self.eventID, self.master, expectedResults)
开发者ID:pkdevboxy,项目名称:testrunner,代码行数:44,代码来源:audittest.py

示例5: test_checkWildCard

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapUserRestOperation [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))
开发者ID:lichia,项目名称:testrunner,代码行数:31,代码来源:ldaptest.py

示例6: setUp

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapUserRestOperation [as 别名]
 def setUp(self):
     self.times_teardown_called = 1
     super(auditcli, self).setUp()
     self.r = random.Random()
     self.vbucket_count = 1024
     self.shell = RemoteMachineShellConnection(self.master)
     info = self.shell.extract_remote_info()
     type = info.type.lower()
     self.excluded_commands = self.input.param("excluded_commands", None)
     self.os = 'linux'
     self.cli_command_path = LINUX_COUCHBASE_BIN_PATH
     if type == 'windows':
         self.os = 'windows'
         self.cli_command_path = WIN_COUCHBASE_BIN_PATH
     if info.distribution_type.lower() == 'mac':
         self.os = 'mac'
         self.cli_command_path = MAC_COUCHBASE_BIN_PATH
     self.couchbase_usrname = "%s" % (self.input.membase_settings.rest_username)
     self.couchbase_password = "%s" % (self.input.membase_settings.rest_password)
     self.cli_command = self.input.param("cli_command", None)
     self.command_options = self.input.param("command_options", None)
     if self.command_options is not None:
         self.command_options = self.command_options.split(";")
     TestInputSingleton.input.test_params["default_bucket"] = False
     self.eventID = self.input.param('id', None)
     AuditTemp = audit(host=self.master)
     self.ipAddress = self.getLocalIPAddress()
     self.ldapUser = self.input.param('ldapUser', 'Administrator')
     self.ldapPass = self.input.param('ldapPass', 'password')
     self.source = self.input.param('source', 'ns_server')
     if type == 'windows' and self.source == 'saslauthd':
         raise Exception(" Ldap Tests cannot run on windows");
     else:
         if self.source == 'saslauthd':
             rest = RestConnection(self.master)
             rest.ldapUserRestOperation(True, [[self.ldapUser]], exclude=None)
开发者ID:pkdevboxy,项目名称:testrunner,代码行数:38,代码来源:auditcli.py

示例7: test_addMoreMultipleAdmin

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import ldapUserRestOperation [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)
开发者ID:lichia,项目名称:testrunner,代码行数:30,代码来源:ldaptest.py


注:本文中的membase.api.rest_client.RestConnection.ldapUserRestOperation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。