def tearDown(self): # 关闭web 认证 login.loginWeb(self) # admin账号登录 self.driver.implicitly_wait(10) self.driver.maximize_window() freeauth = Organization_userAuthPage(self.driver, self.url) # 打开用户管理 - 用户认证 freeauth.click_UserManage() time.sleep(0.5) freeauth.click_userAuth() time.sleep(1) # 开启web认证 freeauth.click_WebAuthC() time.sleep(1) # 断言 提示信息是否有误 status3 = str( freeauth.getAttribute_byXpath(freeauth.WebAuthCs, 'checked')) self.assertEqual(status3, 'true', msg='web认证关闭出错') print('web认证关闭') time.sleep(2) # 关闭免认证 freeauth.click_FreeAuthC() time.sleep(1) # 断言 提示信息是否有误 status4 = str( freeauth.getAttribute_byXpath(freeauth.FreeAuthCs, 'checked')) self.assertEqual(status4, 'true', msg='免认证关闭出错') print('免认证关闭') self.driver.quit() logger.info('tearDown over') logger.info('%s' % ('=' * 50))
def test_003_closeRemoteAuth(self): u'''关闭远程认证''' if Support == '√': logger.info(u'参数支持远程认证') login.loginWeb(self) # admin账号登录 self.driver.implicitly_wait(10) remoteauth = Organization_userAuthPage(self.driver, self.url) remoteauth.click_UserManage() time.sleep(0.3) remoteauth.click_userAuth() time.sleep(1) # 关闭web认证 remoteauth.click_remoteAuthC() time.sleep(1) # 断言 提示信息是否有误 status = str( remoteauth.getAttribute_byXpath(remoteauth.remoteAuthCs, 'checked')) self.assertEqual(status, 'true', msg='远程认证关闭出错') print('远程认证关闭') # 免认证选择 全部用户,然后关闭免认证 remoteauth.click_noConfig() time.sleep(1) remoteauth.click_alluser() time.sleep(0.5) remoteauth.click_save() time.sleep(1) remoteauth.click_FreeAuthC() time.sleep(2) # 断言 提示信息是否有误 status2 = str( remoteauth.getAttribute_byXpath(remoteauth.FreeAuthCs, 'checked')) self.assertEqual(status2, 'true', msg='免认证关闭出错') print('免认证关闭') self.driver.quit() # 清空组织架构组 organization_group.import_empty_template(self) # 判断组织架构是否有其他组 有则清空 print('删除组织架构组 完成') elif Support == '×': logger.info(u'参数不支持远程认证') logger.info('test_003_closeRemoteAuth passed')