def setUp(self): self.system = data_setup.create_system(status=u'Manual') self.group = data_setup.create_group() data_setup.add_group_to_system(self.system,self.group) self.verificationErrors = [] self.selenium = self.get_selenium() self.selenium.start()
def setUp(self): self.system = data_setup.create_system() self.owner = data_setup.create_user(password='******') self.system.owner = self.owner self.admin_group = data_setup.create_group() self.user = data_setup.create_user(password='******') self.admin_group.users.append(self.user) data_setup.add_group_to_system(self.system, self.admin_group, admin=True) self.nobody = data_setup.create_user(password='******') self.selenium = self.get_selenium() self.selenium.start()
def test_schedule_provision_system_has_user_with_group(self): with session.begin(): self.automated_system.user = self.user2 data_setup.add_user_to_group(self.user,self.group) data_setup.add_group_to_system(self.automated_system,self.group) self.logout() self.login(user=self.user.user_name,password='******') # login as admin sel = self.selenium sel.open("view/%s/" % self.automated_system.fqdn) sel.wait_for_page_to_load("30000") sel.click("link=Provision") try: self.failUnless(sel.is_text_present("Schedule provision")) except AssertionError, e: self.verificationErrors.append('Systemgroup has no schedule provision option when system is in use')
def test_system_has_group(self): #Automated machine with session.begin(): data_setup.add_group_to_system(self.automated_system,self.group) # Add systemgroup sel = self.selenium sel.open("") sel.type("simplesearch", "%s" % self.automated_system.fqdn) sel.click("search") sel.wait_for_page_to_load("30000") sel.click("link=%s" % self.automated_system.fqdn) sel.wait_for_page_to_load("30000") try: self.failUnless(not sel.is_text_present("(Take)")) #Should not be here except AssertionError, e: self.verificationErrors.append('Take is present on automated machine with group') # Test for https://bugzilla.redhat.com/show_bug.cgi?id=747328 sel.open('user_change?id=%s' % self.automated_system.id) sel.wait_for_page_to_load("30000") self.assert_('You were unable to change the user for %s' % self.automated_system.fqdn in sel.get_text('//body')) try: self._do_schedule_provision(self.automated_system.fqdn,reraise=True) #Should not be able to provision either except AssertionError, e: #Hmm, this is actually a good thing! pass
def test_manual_system_with_group_when_not_logged_in(self): with session.begin(): system = data_setup.create_system(status=u'Manual') group = data_setup.create_group() data_setup.add_group_to_system(system, group) self.go_to_system_view(system=system)
def test_system_group_user_group(self): #Automated machine with session.begin(): data_setup.add_group_to_system(self.automated_system, self.group) # Add systemgroup data_setup.add_user_to_group(self.user, self.wrong_group) # Add user to group sel = self.selenium self.logout() self.login(user=self.user.user_name, password='******') sel.open("") sel.type("simplesearch", "%s" % self.automated_system.fqdn) sel.click("search") sel.wait_for_page_to_load("30000") sel.click("link=%s" % self.automated_system.fqdn) #this tests the click! sel.wait_for_page_to_load("30000") self.assertEqual("%s" % self.automated_system.fqdn, sel.get_title()) #ensure the page has opened try: self.failUnless(not sel.is_text_present("(Take)")) #Should be not here except AssertionError, e: self.verificationErrors.\ append('Take is available to automated machine with system group privs' ) # Test for https://bugzilla.redhat.com/show_bug.cgi?id=747328 sel.open('user_change?id=%s' % self.automated_system.id) sel.wait_for_page_to_load("30000") self.assert_('You were unable to change the user for %s' % self.automated_system.fqdn in sel.get_text('//body')) with session.begin(): self.user.groups = [self.group] sel.open("") sel.type("simplesearch", "%s" % self.automated_system.fqdn) sel.click("search") sel.wait_for_page_to_load("30000") sel.click("link=%s" % self.automated_system.fqdn) sel.wait_for_page_to_load("30000") try: self.failUnless(sel.is_text_present("(Take)")) #Should be here except AssertionError, e: self.verificationErrors.\ append('Take is not available to automated machine with system group pirvs' ) self._do_schedule_provision(self.automated_system.fqdn) # Now can I actually take it? sel.open("") sel.type("simplesearch", "%s" % self.automated_system.fqdn) sel.click("search") sel.wait_for_page_to_load("30000") sel.click("link=%s" % self.automated_system.fqdn) sel.wait_for_page_to_load("30000") self._do_take(self.automated_system.fqdn) #Manual machine with session.begin(): data_setup.add_group_to_system(self.manual_system, self.group) # Add systemgroup sel = self.selenium sel.open("") sel.type("simplesearch", "%s" % self.manual_system.fqdn) sel.click("search") sel.wait_for_page_to_load("30000") sel.click("link=%s" % self.manual_system.fqdn) sel.wait_for_page_to_load("30000") try: self.failUnless(sel.is_text_present("(Take)")) #Should be here except AssertionError, e: self.verificationErrors.append('Take is not here for manual machine with system group privs') self._do_schedule_provision(self.manual_system.fqdn) # Now can I actually take it? sel.open("") sel.type("simplesearch", "%s" % self.manual_system.fqdn) sel.click("search") sel.wait_for_page_to_load("30000") sel.click("link=%s" % self.manual_system.fqdn) sel.wait_for_page_to_load("30000") self._do_take(self.manual_system.fqdn)
# Test for https://bugzilla.redhat.com/show_bug.cgi?id=747328 sel.open('user_change?id=%s' % self.automated_system.id) sel.wait_for_page_to_load("30000") self.assert_('You were unable to change the user for %s' % self.automated_system.fqdn in sel.get_text('//body')) try: self._do_schedule_provision(self.automated_system.fqdn,reraise=True) #Should not be able to provision either except AssertionError, e: #Hmm, this is actually a good thing! pass else: self.verificationErrors.append('System with group should not have \ schedule provision option for not group members') #Manual machine with session.begin(): data_setup.add_group_to_system(self.manual_system, self.group) # Add systemgroup sel = self.selenium sel.open("") sel.type("simplesearch", "%s" % self.manual_system.fqdn) sel.click("search") sel.wait_for_page_to_load("30000") sel.click("link=%s" % self.manual_system.fqdn) sel.wait_for_page_to_load("30000") try: self.failUnless(not sel.is_text_present("(Take)")) #Should not be here except AssertionError, e: self.verificationErrors.append('Take is present on manual machine with group') # Test for https://bugzilla.redhat.com/show_bug.cgi?id=747328 sel.open('user_change?id=%s' % self.manual_system.id) sel.wait_for_page_to_load("30000") self.assert_('You were unable to change the user for %s' % self.manual_system.fqdn in sel.get_text('//body'))