本文整理汇总了Python中helpers.Helpers.Helpers.doesCreateNewExist方法的典型用法代码示例。如果您正苦于以下问题:Python Helpers.doesCreateNewExist方法的具体用法?Python Helpers.doesCreateNewExist怎么用?Python Helpers.doesCreateNewExist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.Helpers.Helpers
的用法示例。
在下文中一共展示了Helpers.doesCreateNewExist方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testCreatePersonProgramCreatorLogInOut
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import doesCreateNewExist [as 别名]
def testCreatePersonProgramCreatorLogInOut(self):
self.testname="TestCreatePersonProgramCreatorLogInOut"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
aEmail = "auto_email_" + str(do.getRandomNumber(65535)) + "@gmail.com"
aName = do.getUniqueString("name")
aCompany = do.getUniqueString("company")
do.selectMenuInTopRight("Admin Dashboard")
do.selectMenuItemInnerNavDashBoard("People")
do.addPersonInAdminDB(aName, aEmail, aCompany)
self.assertTrue(do.searchPersonInAdminDB(aName), "Fail searching for newly created person in Admin Dashboard.")
# edit person authorization
do.selectMenuItemInnerNavDashBoard("People") # on the roles selection
do.clickOnEditAuthorization(aName)
do.assignUserRole("ProgramCreator")
# now log out and then log in with the new account and try to create a program
oldEmail = "[email protected]"
oldName = "Example User"
absFilePath = expanduser("~") + "/ggrc-core/src/ggrc/login/noop.py"
do.changeUsernameEmail(oldName, aName, oldEmail, aEmail, absFilePath)
do.selectMenuInTopRight("Logout")
# Refresh the page
do.refresh()
# Log in with new user
do.login()
print "Log in as : " + do.whoAmI()
object_list = ["Program", "Workflow", "Audit", "Regulation", "Policy", "Standard", "Contract", "Clause",
"Section", "Objective", "Control", "Person", "OrgGroup", "System","Process", "DataAsset",
"Product", "Project", "Facility", "Market"]
for object in object_list:
# cannot create audit; it requires other non-system wide role
if object == "Audit":
do.assertFalse(do.doesCreateNewExist(object), "Create New button exists for " + str(object))
else:
do.assertTrue(do.doesCreateNewExist(object), "Create New button does not exist for " + str(object))
# should be able to create a program object
last_created_object_link = do.createObject("Program")
object_name = str(do.util.getTextFromXpathString(last_created_object_link)).strip()
self.assertTrue(do.partialMatch("program-auto-test", object_name), "Fail to match program name.")
# Restore old login information
do.changeUsernameEmail(aName, oldName, aEmail, oldEmail, absFilePath)
do.selectMenuInTopRight("Logout")
示例2: testCreatePersonObjectEditorLogInOut
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import doesCreateNewExist [as 别名]
def testCreatePersonObjectEditorLogInOut(self):
self.testname="TestCreatePersonObjectEditorLogInOut"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
# ***************************** run this block of codes if run locally *****************************
if "localhost" in config.url:
print "Executing the block of codes locally ..."
aEmail = "auto_email_" + str(do.getRandomNumber(65535)) + "@gmail.com"
aName = do.getUniqueString("name")
aCompany = do.getUniqueString("company")
do.selectMenuInTopRight("Admin Dashboard")
do.selectMenuItemInnerNavDashBoard("People")
do.addPersonInAdminDB(aName, aEmail, aCompany)
self.assertTrue(do.searchPersonInAdminDB(aName), "Fail searching for newly created person in Admin Dashboard.")
# edit person authorization
do.selectMenuItemInnerNavDashBoard("People") # on the roles selection
do.clickOnEditAuthorization(aName)
do.assignUserRole("ObjectEditor")
# now log out and then log in with the new account and try to create a program
oldEmail = "Example user"
oldName = "[email protected]"
absFilePath = expanduser("~") + "/ggrc-core/src/ggrc/login/noop.py"
do.changeUsernameEmail(oldName, aName, oldEmail, aEmail, absFilePath)
do.selectMenuInTopRight("Logout")
# Refresh the page
do.refresh()
# Log in with new user
do.login()
print "Log in as : " + do.whoAmI()
object_list = ["Workflow", "Vendor", "Regulation", "Policy", "Standard", "Contract", "Clause", "Section",
"Section", "Objective", "Control", "Person", "OrgGroup", "System","Process", "DataAsset",
"Product", "Project", "Facility", "Market", "Program", "Audit"]
# since it's an object editor role, the Create New button won't show for certain types
for object in object_list:
if object=="Program" or object=="Audit":
do.assertFalse(do.doesCreateNewExist(object), "Create New button exists for " + str(object))
else:
do.assertTrue(do.doesCreateNewExist(object), "Create New button does not exist for " + str(object))
# should be able to create an object that is not Program or Audit
last_created_object_link = do.createObject("Contract")
object_name = str(do.util.getTextFromXpathString(last_created_object_link)).strip()
self.assertTrue(do.partialMatch("contract-auto-test", object_name), "Fail to match contract name.")
# Restore old login information
do.changeUsernameEmail(aName, oldName, aEmail, oldEmail, absFilePath)
do.selectMenuInTopRight("Logout")
# ******************* execute this else block of codes if not run locally *******************
else:
print "Executing the block of codes for non-local ..."
aEmail = config.editor2
aName = do.getUniqueString("name")
aCompany = do.getUniqueString("company")
do.selectMenuInTopRight("Admin Dashboard")
do.selectMenuItemInnerNavDashBoard("People")
do.addPersonInAdminDB(aName, aEmail, aCompany)
self.assertTrue(do.searchPersonInAdminDB(aName), "Fail searching for newly created person in Admin Dashboard.")
# edit person authorization
do.selectMenuItemInnerNavDashBoard("People") # on the roles selection
do.clickOnEditAuthorization(aName)
do.assignUserRole("ObjectEditor")
# now log out and then log in with the new account and try to create a program
do.selectMenuInTopRight("Logout")
# Refresh the page
do.refresh()
# Log in with new user
do.login(aEmail, config.password)
print "Log in as : " + do.whoAmI()
object_list = ["Workflow", "Vendor", "Regulation", "Policy", "Standard", "Contract", "Clause", "Section",
"Section", "Objective", "Control", "Person", "OrgGroup", "System","Process", "DataAsset",
"Product", "Project", "Facility", "Market", "Program", "Audit"]
# since it's an object editor role, the Create New button won't show for certain types
for object in object_list:
do.ensureLHNSectionExpanded(object)
if object=="Program" or object=="Audit":
#.........这里部分代码省略.........
示例3: testCreatePersonReaderLogInOut
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import doesCreateNewExist [as 别名]
def testCreatePersonReaderLogInOut(self):
self.testname="TestCreatePersonReaderLogInOut"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
# run this block of codes if run locally
if "localhost" in config.url:
print "Executing the block of codes locally ..."
aEmail = "auto_email_" + str(do.getRandomNumber(65535)) + "@gmail.com"
aName = do.getUniqueString("name")
aCompany = do.getUniqueString("company")
do.selectMenuInTopRight("Admin Dashboard")
do.selectMenuItemInnerNavDashBoard("People")
do.addPersonInAdminDB(aName, aEmail, aCompany)
self.assertTrue(do.searchPersonInAdminDB(aName), "Fail searching for newly created person in Admin Dashboard.")
# edit person authorization
do.selectMenuItemInnerNavDashBoard("People") # on the roles selection
do.clickOnEditAuthorization(aName)
do.assignUserRole("Reader")
# now log out and then log in with the new account and try to create a program
oldEmail = "[email protected]"
oldName = "Example User"
absFilePath = expanduser("~") + "/ggrc-core/src/ggrc/login/noop.py"
do.changeUsernameEmail(oldName, aName, oldEmail, aEmail, absFilePath)
do.selectMenuInTopRight("Logout")
# Refresh the page
do.refresh()
# Log in with new user
do.login()
print "Log in as : " + do.whoAmI()
object_list = ["Vendor", "Regulation", "Policy", "Standard", "Contract", "Clause", "Section",
"Section", "Objective", "Control", "Person", "OrgGroup", "System","Process", "DataAsset",
"Product", "Project", "Facility", "Market", "Program", "Audit"]
# since it's a reader role, the Create New button won't show
for object in object_list:
do.assertFalse(do.doesCreateNewExist(object), "Create New button exists for " + str(object))
print "hi"
# Restore old login information
do.changeUsernameEmail(aName, oldName, aEmail, oldEmail, absFilePath)
do.selectMenuInTopRight("Logout")
else:
print "Executing the block of codes for non-local ..."
aEmail = config.reader2
aName = do.getUniqueString("name")
aCompany = do.getUniqueString("company")
do.selectMenuInTopRight("Admin Dashboard")
do.selectMenuItemInnerNavDashBoard("People")
do.addPersonInAdminDB(aName, aEmail, aCompany)
self.assertTrue(do.searchPersonInAdminDB(aName), "Fail searching for newly created person in Admin Dashboard.")
# edit person authorization
do.selectMenuItemInnerNavDashBoard("People") # on the roles selection
do.clickOnEditAuthorization(aName)
do.assignUserRole("Reader")
# now log out and then log in with the new account and try to create a program
do.selectMenuInTopRight("Logout")
# Refresh the page
do.refresh()
# Log in with new user
do.login(aEmail, config.same_password)
print "Log in as : " + do.whoAmI()
# Workflow is left out on purpose because Create New is there but reader can't create object anyway
object_list = ["Vendor", "Regulation", "Policy", "Standard", "Contract", "Clause", "Section",
"Section", "Objective", "Control", "Person", "OrgGroup", "System","Process", "DataAsset",
"Product", "Project", "Facility", "Market", "Program", "Audit"]
# since it's a reader role, the Create New button won't show
for object in object_list:
do.ensureLHNSectionExpanded(object)
do.assertFalse(do.doesCreateNewExist(object), "Create New button exists for " + str(object))