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


Python Helpers.importFile方法代码示例

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


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

示例1: testImportExportSystem

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import importFile [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
开发者ID:amrishs,项目名称:ggrc-test,代码行数:58,代码来源:TestImportExportSystem.py

示例2: testImportExportHelp

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import importFile [as 别名]
  def testImportExportHelp(self):
      self.testname="TestImportExportHelp"
      self.setup()
      util = WebdriverUtilities()
      util.setDriver(self.driver)
      do = Helpers(self)
      do.setUtils(util)
      do.login()
   
      # export help
      filePath = config.test_db + "HELP.csv"
      do.selectMenuInTopRight("Admin Dashboard")
      do.exportFile("help", filePath)
 
      # import help
      do.importFile("Processes", filePath)
开发者ID:amrishs,项目名称:ggrc-test,代码行数:18,代码来源:TestImportExportHelp.py

示例3: testImportPeopleValidation

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import importFile [as 别名]
    def testImportPeopleValidation(self):
        self.testname="TestImportPeopleValidation"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        do = Helpers(self)
        do.setUtils(util)
        do.login()

        do.selectMenuInTopRight("Admin Dashboard")
        self.assertFalse(do.importFile("People", self.dupEmail, False, "Error"), "Fail negative test on duplicate email.")   
          
        do.selectMenuInTopRight("Admin Dashboard")  
        self.assertFalse(do.importFile("People", self.noEmail, False, "Error"), "Fail negative test with email field.") 
         
        do.selectMenuInTopRight("Admin Dashboard")
        self.assertFalse(do.importFile("People", self.wrongType, False, "Error"), "Fail negative test where type is not people.") 
        
        # THIS ONE FAILS BECAUSE THERE IS A AN ACTUAL BUG !!!  16463790 "Uncaught SecurityError" 
        print ("THIS ONE FAILS BECAUSE THERE IS A AN ACTUAL BUG !!!  16463790 'Uncaught SecurityError.' ")
        print ("Need to uncomment when it's fixed.")
开发者ID:amrishs,项目名称:ggrc-test,代码行数:23,代码来源:TestImportPeopleValidation.py

示例4: testImportProcessesValidation

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import importFile [as 别名]
    def testImportProcessesValidation(self):
        noRow = config.test_db + "PROCESSES_NO_ROW.csv"
        wrongType = config.test_db + "PROCESSES_WRONG_TYPE.csv"
        noTitle = config.test_db + "PROCESSES_NO_TITLE.csv"
        dupTitle = config.test_db + "PROCESSES_DUP_TITLE.csv"
      
        self.testname="TestImportProcessesValidation"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        do = Helpers(self)
        do.setUtils(util)
        do.login()

        do.selectMenuInTopRight("Admin Dashboard")
        self.assertFalse(do.importFile("Processes", noRow, False, "Warning: Missing column"), "Fail negative test on file with now data.")   
             
        do.selectMenuInTopRight("Admin Dashboard")        
        self.assertFalse(do.importFile("Processes", wrongType, False, "Warning: Type must be"), "Fail negative test on file with wrong data type.")
        self.assertEquals(do.getWrongTypeMessage(),"Type must be \"Processes\"", "Fail to display 'wrong type' message.")
          
        do.selectMenuInTopRight("Admin Dashboard")        
        self.assertTrue(do.importFile("Processes", noTitle, True), "Fail negative test on file with no title.")
        self.assertEquals(do.getImportFailedMessage(), "Error!", "Fail to display 'Error' message. ")
开发者ID:amrishs,项目名称:ggrc-test,代码行数:26,代码来源:TestImportProcessesValidation.py

示例5: testImportExportPeople

# 需要导入模块: from helpers.Helpers import Helpers [as 别名]
# 或者: from helpers.Helpers.Helpers import importFile [as 别名]
    def testImportExportPeople(self):
        self.testname="TestImportExportPeople"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        do = Helpers(self)
        do.setUtils(util)
        do.login()

        # create a person
        number = str(do.getRandomNumber())
        aEmail = "email" + number + "@gmail.com"
        aName =  "name" + number   
        aCompany = "company" + number              
        do.createPersonLHN(aName, aEmail, aCompany)

        do.uncheckMyWorkBox()
        do.navigateToObjectWithSearch(aName, "Person")
        
        print ""
        print "On screen."
        print "User is displayed as : " + aName
        print "Email is displayed as : " + aEmail
        print "Company is displayed as : " + aCompany
        
# export people
        filePath = config.test_db + "PEOPLE.csv"
        print filePath
        do.selectMenuInTopRight("Admin Dashboard")
        do.exportFile("people", filePath)
               
        # verify that information in file matched
        self.assertTrue(do.verifyPeopleExportFile(aName, aEmail, aCompany, filePath), "User not found in exported file.")
   
# import people
        # create some data, add it to the import file and upload       
        number = str(do.getRandomNumber())
        aEmail = "emailImport" + number + "@gmail.com"
        aName =  "nameImport" + number   
        aCompany = "companyImport" + number  
        
        print ""
        print "Add this new user info to the import file and upload."
        print "User name: " + aName
        print "Email: " + aEmail
        print "Company: " + aCompany
        userInfo = aName + "," + aEmail + "," + aCompany
        
        # proof: verify that this user never exist in the database
        do.navigateToObjectWithSearchWithNoAssertion(aName, "Person")
        count = do.countOfAnyObjectLHS("Person")
        self.assertEqual(0, count, "User " + aName + " is verified not existed.")
                
        do.appendToFile(userInfo, filePath)
        do.importFile("People", filePath)
        do.refresh()   
        
        # after import, verify that user has been added to the database
        do.navigateToObjectWithSearch(aName, "Person")
        count = do.countOfAnyObjectLHS("Person")
        self.assertEqual(1, count, "User " + aName + " is verified not existed.")
        self.assertEqual(aName, do.getObjectNavWidgetInfo("username"), "User's name " + aName + " is not found in the database.")
        self.assertEqual(aEmail, do.getObjectNavWidgetInfo("email"), "User's email " + aEmail + " is not found in the database.")
        self.assertEqual(aCompany, do.getObjectNavWidgetInfo("company"), "User's company " + aCompany + " is not found in the database.")
        
        print ""
        print "User is imported successfully and found in the database."
        print aName + "," + aEmail + "," + aCompany
开发者ID:amrishs,项目名称:ggrc-test,代码行数:70,代码来源:TestImportExportPeople.py


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