本文整理汇总了Python中helpers.Helpers.Helpers.createObject方法的典型用法代码示例。如果您正苦于以下问题:Python Helpers.createObject方法的具体用法?Python Helpers.createObject怎么用?Python Helpers.createObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.Helpers.Helpers
的用法示例。
在下文中一共展示了Helpers.createObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testNoAccessRole
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testNoAccessRole(self):
self.testname="TestNoAccessRole"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
email = config.reader1
reader = config.reader2
password = config.same_password
title = "Auto_Private_" + do.getTimeId() + str(do.getRandomNumber())
do.createObject("Program", title, "checked")
do.verifyObjectIsCreatedinLHN("Program", title)
do.assertEqual(1, do.countOfAnyObjectLHS("Program"), "Expect count to be 1 but don't see it.")
# 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(reader, password)
print "Log in as : " + do.whoAmI()
do.uncheckMyWorkBox()
try:
do.verifyObjectIsCreatedinLHN("Program", title)
except:
do.assertEqual(0, do.countOfAnyObjectLHS("Program"), "Expect count to be 0 but don't see it.")
print "Good...private program should not be visible to reader role unless permitted."
示例2: testFourLevelsMapping
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testFourLevelsMapping(self):
self.testname="TestFourLevelsMapping"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
# mapping and un-mapping up to 3 levels:
# Program->Regulation->Section->Object
titlePol = do.getUniqueString("policy")
titlePrgm = do.getUniqueString("program")
titleSec = do.getUniqueString("section")
titleMkt = do.getUniqueString("policy")
do.createObject("Policy", titlePol)
do.createObject("Program", titlePrgm)
do.mapAObjectWidget("Policy", titlePol)
do.createObject("Market", titleMkt)
do.createObject("Section", titleSec)
do.mapAObjectWidget("Market", titleMkt)
do.mapAObjectWidget("Section", titleSec)
示例3: testMapRegulationToSystem
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testMapRegulationToSystem(self):
self.testname="TestMapRegulationToSystem"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
titleReg = do.getUniqueString("regulation")
titleSys = do.getUniqueString("system")
do.createObject("Regulation", titleReg)
do.createObject("System", titleSys)
do.mapAObjectLHN("Regulation", titleReg)
示例4: testCreatePersonProgramCreatorLogInOut
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [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")
示例5: testImportExportSystem
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testImportExportSystem(self):
self.testname="TestImportExportSystem"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
do = Helpers(self)
do.setUtils(util)
do.login()
# create a system
systemObject =do.createObject("System")
systemObject = str(util.getTextFromXpathString(systemObject)) #it's name, not xpath
print ""
print "On screen."
print "System object is displayed as : " + systemObject
# export system
filePath = config.test_db + "SYSTEMS.csv"
do.selectMenuInTopRight("Admin Dashboard")
do.exportFile("systems", filePath)
# verify that information in file matched
self.assertTrue(do.verifyDataInExportFile(systemObject, filePath), "System object not found in exported file.")
# import system
# create some data, add it to the import file and upload
number = str(do.getRandomNumber())
systemObject = "systemImport" + number
print ""
print "Add this new system object to the import file and upload."
print "System object: " + systemObject
# proof: verify that this user never exist in the database
do.navigateToObjectWithSearchWithNoAssertion(systemObject, "System")
count = do.countOfAnyObjectLHS("System")
self.assertEqual(0, count, "System " + systemObject + " is verified not existed.")
# make it complete
conformingText = "SYSTEM-" + number + "," + systemObject + ",,,,,,[email protected],,,,,,2014-7-16,2014-7-16,,Draft"
do.appendToFile(conformingText, filePath)
do.importFile("Systems", filePath)
do.refresh()
# after import, verify that user has been added to the database
do.navigateToObjectWithSearch(systemObject, "System")
count = do.countOfAnyObjectLHS("System")
self.assertEqual(1, count, "System " + systemObject + " is not added successfully.")
self.assertEqual(systemObject, do.getObjectNavWidgetInfo("username"), "System object " + systemObject + " is not found in the database.")
print ""
print "System object is imported successfully and found in the database."
print systemObject
示例6: testMapSystemToPeople
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testMapSystemToPeople(self):
self.testname="TestMapSystemToPeople"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
aEmail = "auto_email_" + str(do.getRandomNumber()) + "@gmail.com"
aName = do.getUniqueString("name")
aCompany = do.getUniqueString("company")
titleSys = do.getUniqueString("system")
do.createObject("System", titleSys)
do.createPersonLHN(aName, aEmail, aCompany)
do.mapAObjectLHN("System", titleSys)
示例7: testProgramCreate
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testProgramCreate(self):
self.testname="TestProgramCreate"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
last_created_object_link =do.createObject("Program")
do.navigateToObjectAndOpenObjectEditWindow("Program",last_created_object_link)
do.deleteObject()
示例8: testSystemCreate
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testSystemCreate(self):
self.testname="TestSystemCreate"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
do = Helpers(self)
do.setUtils(util)
do.login()
last_created_object_link =do.createObject("System")
#object_name = str(util.getTextFromXpathString(last_created_object_link)).strip()
do.navigateToObjectAndOpenObjectEditWindow("System",last_created_object_link)
do.deleteObject()
示例9: testEventLog
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testEventLog(self):
self.testname="TestEventLog"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
grcobject = GRCObject()
do = Helpers(self)
do.setUtils(util)
do.login()
# CREATE PROGRAM
program_name = "Program_created_from_LHN" + do.getTimeId()
object_list = ["Regulation", "Contract", "Policy", "Standard"]
last_created_object_link = do.createObject("Program", program_name)
# MAP SOME OBJECTS
for obj in object_list:
do.mapAObjectLHN(obj, program_name)
#do.selectInnerTabWhichAlreadyPresent("info")
do.selectInnerNavTab("info")
do.openObjectEditWindow()
do.deleteObject()
do.selectMenuInTopRight("Admin Dashboard")
do.selectMenuItemInnerNavDashBoard("Events")
# when delete an object that has mapping, it automatically unmap and then delete
self.assertTrue(do.verifyInfoInEventLogTable("unmapped from", 1), "Cannot find 'unmapped from Program' in the Event Log table.")
# 4 times
# 4 lines of "mapped to" because there are 4 mappings from the top
self.assertTrue(do.verifyInfoInEventLogTable("mapped to", 2), "Cannot find 'map to:row2' in the Event Log table.")
self.assertTrue(do.verifyInfoInEventLogTable("mapped to", 3), "Cannot find 'map to:row3' in the Event Log table.")
self.assertTrue(do.verifyInfoInEventLogTable("mapped to", 4), "Cannot find 'map to:row4' in the Event Log table.")
self.assertTrue(do.verifyInfoInEventLogTable("mapped to", 5), "Cannot find 'map to:row5' in the Event Log table.")
# tests the "by whom" and "when at" fields
self.assertTrue(do.verifyInfoInEventLogTable("whom", 2), "Cannot find 'whom' in the Event Log table.")
self.assertTrue(do.verifyInfoInEventLogTable("when", 2), "Cannot find 'when' in the Event Log table.")
# the program created should be logged
self.assertTrue(do.verifyInfoInEventLogTable(program_name, 6), "Cannot find 'create program' in the Event Log table.")
# verify that Prev and Next buttons work
self.assertTrue(do.verifyPrevNextOperation(), "Fail verifying Prev and Next buttons.")
# CORE-727
print "CORE-727 is still open which causes this failure."
示例10: testRelevantStress
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testRelevantStress(self):
self.testname="TestRelevantStress"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
do = Helpers(self)
do.setUtils(util)
do.login()
titleContract = do.getUniqueString("contract")
titleClause = do.getUniqueString("clause")
print "Contract: " + titleContract
print "Clause: " + titleClause
# SETUP
do.checkMyWorkBox() # show my objects only
# Make sure we have at least 20 data assets already if not create them
count = do.countOfAnyObjectLHS("Data")
diff = 20 - count
while diff > 0:
id = do.getRandomNumber()
do.createObject("Data", "data_" + str(id))
diff = diff - 1
do.delay(5)
# Map 20 data assets to Clause
do.createObject("Clause", titleClause)
expandables = []
do.mapAObjectWidget("Data_Asset", "data_", False, expandables, 20)
# Map a clause to contract
do.createObject("Contract", titleContract)
do.mapAObjectWidget("Clause", titleClause, False, ("Clause"), 1)
# expand it
do.expandItemWidget("Clause", titleClause)
# check the MakeAllRelevant checkbox
do.makeAllRelevant(True)
do.delay(120)
# switch to Data Asset tab
do.selectInnerNavTab("data_asset")
do.assertEqual(20, do.countOfAnyObjectInWidget("data_asset"), "Count is not 20 in Data Asset Widget.")
# just select because it will maintain its expanded mode
do.selectInnerNavTab("clause")
do.makeAllRelevant(False)
do.delay(120) # takes time for the unmapping to complete
# switch to Data Asset tab again
do.selectInnerNavTab("data_asset")
# if MAKE ALL RELEVANT checkbox is deselected, no data asset tab is shown and thus no count is shown either
print "Continue to fail until CORE-890 is fixed."
do.assertEqual(0, do.countOfAnyObjectInWidget("data_asset"), "Count is not 0 in Data Asset Widget.")
示例11: testVendorMapWidget
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testVendorMapWidget(self):
self.testname="TestVendorMapWidget"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
grcobject = GRCObject()
do = Helpers(self)
do.setUtils(util, "Vendor")
do.login()
vendor_name = "Vendor for Auto Mapping from Widget" + do.getTimeId()
last_created_object_link = do.createObject("Vendor", vendor_name)
for obj in grcobject.vendor_map_to_widget:
do.mapAObjectWidget(obj, "")
示例12: testPolicyMapWidget
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testPolicyMapWidget(self):
self.testname="TestPolicyMapWidget"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
grcobject = GRCObject()
do = Helpers(self)
do.setUtils(util, "Policy")
do.login()
policy_name = "Policy for Auto Mapping from Widget" +do.getTimeId()
last_created_object_link = do.createObject("Policy", policy_name)
for obj in grcobject.policy_map_to_widget:
do.mapAObjectWidget(obj, policy_name, False, ("Section", "Objective", "Control"))
示例13: testDataAssetMapWidget
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testDataAssetMapWidget(self):
self.testname="TestDataAssetMapWidget"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
grcobject = GRCObject()
do = Helpers(self)
do.setUtils(util, "DataAsset")
do.login()
data_asset_name = "DataAsset for Auto Mapping from Widget" +do.getTimeId()
last_created_object_link = do.createObject("DataAsset",data_asset_name)
for obj in grcobject.data_asset_map_to_widget:
do.mapAObjectWidget(obj)
示例14: testProgramMapWidget
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testProgramMapWidget(self):
self.testname="TestProgramMapWidget"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
grcobject = GRCObject()
do = Helpers(self)
do.setUtils(util, "Program")
do.login()
program_name = "Program for Auto Mapping from Widget" + do.getTimeId()
last_created_object_link = do.createObject("Program", program_name)
for obj in grcobject.program_map_to_widget:
do.mapAObjectWidget(obj, "", True, ("Control", "Objective", "System"))
示例15: testControlMapWidget
# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import createObject [as 别名]
def testControlMapWidget(self):
self.testname="TestControlMapWidget"
self.setup()
util = WebdriverUtilities()
util.setDriver(self.driver)
element = Elements()
grcobject = GRCObject()
do = Helpers(self)
do.setUtils(util, "Control")
do.login()
control_name = "Control for Auto Mapping from Widget" + do.getTimeId()
last_created_object_link = do.createObject("Control", control_name)
for obj in grcobject.control_map_to_widget:
do.mapAObjectWidget(obj)