コード例 #1
0
 def testSaveAndAddAnotherProject(self):
     self.testname="TestSaveAndAddAnotherProject"
     self.setup()
     util = WebdriverUtilities()
     util.setDriver(self.driver)
     element = Elements()
     do = Helpers(self)
     do.setUtils(util)
     do.login()
     
     object_1_name = do.generateNameForTheObject("Project")
     do.delay(10) # count number does not appear right away, weird
     object_2_name = "Project_" + str(do.getRandomNumber())
     
     do.ensureLHNSectionExpanded("Project")
     count_before = do.countOfAnyObjectLHS("Project")
     do.createObjectSaveAddAnother("Project", object_1_name, "unchecked", True, "", False)
     do.createObjectSaveAddAnother("Project", object_2_name, "unchecked", False, "", True)
     do.clearSearchBoxOnLHS() #clear any text so total count displays
     do.ensureLHNSectionExpanded("Project")
     count_after = do.countOfAnyObjectLHS("Project")
           
     do.assertEqual(count_after, count_before+2, "Count has not incremented by 1 as expected.") 
            
     print "Object 1: "
     object_1_link = do.verifyObjectIsCreatedinLHN("Project", object_1_name)
     do.navigateToObjectAndOpenObjectEditWindow("Project",object_1_link)
     do.deleteObject()
     
     print "Object 2: "
     object_2_link = do.verifyObjectIsCreatedinLHN("Project", object_2_name)
     do.navigateToObjectAndOpenObjectEditWindow("Project",object_2_link)
     do.deleteObject()        
コード例 #2
0
ファイル: TestNoAccessRole.py プロジェクト: amrishs/ggrc-test
    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."