def test_can_reserve_manual_system(self):
     with session.begin():
         broken_system = data_setup.create_system(arch=u'i386', shared=True,
                                                  status=SystemStatus.broken,
                                                  lab_controller=self.lc)
         manual_system = data_setup.create_system(arch=u'i386', shared=True,
                                                  status=SystemStatus.manual,
                                                  lab_controller=self.lc)
     b = self.browser
     login(b)
     # broken system should not be present
     go_to_reserve_systems(b, distro_tree=self.distro_tree_i386)
     search_for_system(b, broken_system)
     check_system_search_results(b, absent=[broken_system])
     # provision manual system
     go_to_reserve_systems(b, distro_tree=self.distro_tree_i386)
     search_for_system(b, manual_system)
     row = b.find_element_by_xpath('//tr[normalize-space(string(td))="%s"]' % manual_system.fqdn)
     row.find_element_by_link_text('Reserve Now').click()
     b.find_element_by_xpath('//button[normalize-space(text())="Submit job"]').click()
     # should end up on the job page
     job_id = b.find_element_by_xpath('//td[preceding-sibling::th/text()="Job ID"]/a').text
     with session.begin():
         job = TaskBase.get_by_t_id(job_id)
         cloned_job_xml = job.to_xml(clone=True).toxml() # cloning re-parses hostRequires
         self.assertIn(
             u'<hostRequires force="%s"/>' % manual_system.fqdn,
             cloned_job_xml)
 def test_can_reserve_manual_system(self):
     with session.begin():
         broken_system = data_setup.create_system(
             arch=u"i386", shared=True, status=SystemStatus.broken, lab_controller=self.lc
         )
         manual_system = data_setup.create_system(
             arch=u"i386", shared=True, status=SystemStatus.manual, lab_controller=self.lc
         )
     b = self.browser
     login(b)
     # broken system should not be present
     go_to_reserve_systems(b, distro_tree=self.distro_tree_i386)
     search_for_system(b, broken_system)
     check_system_search_results(b, absent=[broken_system])
     # provision manual system
     go_to_reserve_systems(b, distro_tree=self.distro_tree_i386)
     search_for_system(b, manual_system)
     row = b.find_element_by_xpath('//tr[normalize-space(string(td))="%s"]' % manual_system.fqdn)
     row.find_element_by_link_text("Reserve Now").click()
     b.find_element_by_xpath('//button[normalize-space(text())="Submit job"]').click()
     # should end up on the job page
     job_id = b.find_element_by_xpath('//td[preceding-sibling::th/text()="Job ID"]/a').text
     with session.begin():
         job = TaskBase.get_by_t_id(job_id)
         cloned_job_xml = job.to_xml(clone=True).toxml()  # cloning re-parses hostRequires
         self.assertIn(u'<hostRequires force="%s"/>' % manual_system.fqdn, cloned_job_xml)
 def check_system_is_available(self, system):
     """
     Checks that the system can be found by searching on the Available page, 
     indicating that the logged-in user has access to reserve it.
     """
     b = self.browser
     b.get(get_server_base() + 'available')
     search_for_system(b, system)
     check_system_search_results(b, present=[system])
Beispiel #4
0
 def test_secret_system_not_visible(self):
     with session.begin():
         secret_system = data_setup.create_system(shared=False, private=True)
     b = self.browser
     login(b, user=self.user.user_name, password=u'password')
     b.get(get_server_base())
     search_for_system(b, secret_system)
     # results grid should be empty
     b.find_element_by_xpath('//table[@id="widget" and not(.//td)]')
 def test_secret_system_not_visible(self):
     with session.begin():
         secret_system = data_setup.create_system(shared=False, private=True)
     b = self.browser
     login(b, user=self.user.user_name, password=u'password')
     b.get(get_server_base())
     search_for_system(b, secret_system)
     # results grid should be empty
     b.find_element_by_xpath('//table[@id="widget" and not(.//td)]')
 def check_system_is_available(self, system):
     """
     Checks that the system can be found by searching on the Available page, 
     indicating that the logged-in user has access to reserve it.
     """
     b = self.browser
     b.get(get_server_base() + 'available')
     search_for_system(b, system)
     check_system_search_results(b, present=[system])
 def check_system_is_free(self, system):
     """
     Checks that the system can be found by searching on the Free page, 
     indicating that the logged-in user has access to reserve it and it is 
     currently not in use.
     """
     b = self.browser
     b.get(get_server_base() + 'free')
     search_for_system(b, system)
     check_system_search_results(b, present=[system])
 def test_secret_system_visible_when_loaned(self):
     with session.begin():
         secret_system = data_setup.create_system(shared=False, private=True)
         secret_system.loaned = self.user
     b = self.browser
     login(b, user=self.user.user_name, password=u'password')
     b.get(get_server_base())
     search_for_system(b, secret_system)
     b.find_element_by_xpath('//table[@id="widget"]'
             '//tr/td[1][./a/text()="%s"]' % secret_system.fqdn)
 def check_system_is_free(self, system):
     """
     Checks that the system can be found by searching on the Free page, 
     indicating that the logged-in user has access to reserve it and it is 
     currently not in use.
     """
     b = self.browser
     b.get(get_server_base() + 'free')
     search_for_system(b, system)
     check_system_search_results(b, present=[system])
Beispiel #10
0
 def test_secret_system_visible_when_loaned(self):
     with session.begin():
         secret_system = data_setup.create_system(shared=False, private=True)
         secret_system.loaned = self.user
     b = self.browser
     login(b, user=self.user.user_name, password=u'password')
     b.get(get_server_base())
     search_for_system(b, secret_system)
     b.find_element_by_xpath('//table[@id="widget"]'
             '//tr/td[1][./a/text()="%s"]' % secret_system.fqdn)
Beispiel #11
0
 def test_by_distro(self):
     login(self.browser)
     b = self.browser
     go_to_reserve_systems(b, self.distro_tree)
     search_for_system(b, self.system)
     self.failUnless(is_text_present(b, self.system.fqdn))
     b.find_element_by_link_text('Reserve Now').click()
     b.find_element_by_name('whiteboard').send_keys(unicode(self.distro_tree))
     b.find_element_by_id('form').submit()
     self.assert_('Success' in b.find_element_by_css_selector('.flash').text)
Beispiel #12
0
 def test_admin_cannot_reserve_any_system(self):
     with session.begin():
         group_system = data_setup.create_system(shared=True)
         group_system.lab_controller = self.lc
         group_system.groups.append(data_setup.create_group())
     login(self.browser)
     b = self.browser
     go_to_reserve_systems(b, self.distro_tree)
     search_for_system(b, group_system)
     b.implicitly_wait(0)
     self.assert_(is_results_table_empty(b))
 def test_secret_system_visible_to_users_with_view_permission(self):
     with session.begin():
         secret_system = data_setup.create_system(shared=False, private=True)
         secret_system.custom_access_policy.add_rule(SystemPermission.view,
                 user=self.user)
     b = self.browser
     login(b, user=self.user.user_name, password=u'password')
     b.get(get_server_base())
     search_for_system(b, secret_system)
     b.find_element_by_xpath('//table[@id="widget"]'
             '//tr/td[1][./a/text()="%s"]' % secret_system.fqdn)
Beispiel #14
0
 def test_secret_system_visible_to_users_with_view_permission(self):
     with session.begin():
         secret_system = data_setup.create_system(shared=False, private=True)
         secret_system.custom_access_policy.add_rule(SystemPermission.view,
                 user=self.user)
     b = self.browser
     login(b, user=self.user.user_name, password=u'password')
     b.get(get_server_base())
     search_for_system(b, secret_system)
     b.find_element_by_xpath('//table[@id="widget"]'
             '//tr/td[1][./a/text()="%s"]' % secret_system.fqdn)
Beispiel #15
0
 def test_by_distro(self):
     login(self.browser)
     b = self.browser
     go_to_reserve_systems(b, self.distro_tree)
     #https://bugzilla.redhat.com/show_bug.cgi?id=1154887
     search_for_system(b, self.system)
     b.find_element_by_xpath('//tr[normalize-space(string(td[1]))="%s"]'
             '/td/a[text()="Reserve Now"]' % self.system.fqdn).click()
     b.find_element_by_name('whiteboard').send_keys(unicode(self.distro_tree))
     b.find_element_by_xpath('//button[text()="Submit job"]').click()
     # we should end up on the job page
     b.find_element_by_xpath('//h1[contains(string(.), "J:")]')
 def test_by_distro(self):
     login(self.browser)
     b = self.browser
     go_to_reserve_systems(b, self.distro_tree)
     #https://bugzilla.redhat.com/show_bug.cgi?id=1154887
     search_for_system(b, self.system)
     b.find_element_by_xpath('//tr[normalize-space(string(td[1]))="%s"]'
             '/td/a[text()="Reserve Now"]' % self.system.fqdn).click()
     b.find_element_by_name('whiteboard').send_keys(unicode(self.distro_tree))
     b.find_element_by_xpath('//button[text()="Submit job"]').click()
     # we should end up on the job page
     b.find_element_by_xpath('//th[text()="Job ID"]')
 def test_admin_cannot_reserve_any_system(self):
     with session.begin():
         group_system = data_setup.create_system(shared=False)
         group_system.lab_controller = self.lc
         group_system.custom_access_policy.add_rule(
                 permission=SystemPermission.reserve,
                 group=data_setup.create_group())
     login(self.browser)
     b = self.browser
     go_to_reserve_systems(b, self.distro_tree)
     search_for_system(b, group_system)
     b.implicitly_wait(0)
     self.assert_(is_results_table_empty(b))
Beispiel #18
0
    def test_loaned_not_used_system_not_shown(self):
        with session.begin():
            pass_ ='password'
            user_1 = data_setup.create_user(password=pass_)
            user_2 = data_setup.create_user(password=pass_)
            self.system.loaned = user_1
        b = self.browser
        login(b, user=user_1.user_name, password=pass_)
        go_to_reserve_systems(b, self.distro_tree)
        search_for_system(b, self.system)
        self.assert_(is_text_present(b, 'Reserve Now'))

        logout(b)
        login(b, user=user_2.user_name, password=pass_)
        go_to_reserve_systems(b, self.distro_tree)
        search_for_system(b, self.system)
        self.assert_(is_text_present(b, 'Queue Reservation'))
Beispiel #19
0
    def test_exluded_distro_system_not_there(self):
        with session.begin():
            self.system.excluded_osmajor.append(ExcludeOSMajor(
                    osmajor=self.distro_tree.distro.osversion.osmajor,
                    arch=self.distro_tree.arch))
        login(self.browser)
        b = self.browser
        go_to_reserve_systems(b, self.distro_tree)
        search_for_system(b, self.system)
        b.implicitly_wait(0)
        self.assert_(is_results_table_empty(b))
        b.implicitly_wait(10)

        with session.begin():
            self.system.arch.append(Arch.by_name(u'x86_64')) # Make sure it still works with two archs
        go_to_reserve_systems(b, self.distro_tree)
        search_for_system(b, self.system)
        b.implicitly_wait(0)
        self.assert_(is_results_table_empty(b))
Beispiel #20
0
 def test_can_reserve_manual_system(self):
     with session.begin():
         broken_system = data_setup.create_system(
             arch=u'i386',
             shared=True,
             status=SystemStatus.broken,
             lab_controller=self.lc)
         manual_system = data_setup.create_system(
             arch=u'i386',
             shared=True,
             status=SystemStatus.manual,
             lab_controller=self.lc)
     b = self.browser
     login(b)
     # broken system should not be present
     go_to_reserve_systems(b, distro_tree=self.distro_tree_i386)
     search_for_system(b, broken_system)
     check_system_search_results(b, absent=[broken_system])
     # provision manual system
     go_to_reserve_systems(b, distro_tree=self.distro_tree_i386)
     search_for_system(b, manual_system)
     row = b.find_element_by_xpath(
         '//tr[normalize-space(string(td))="%s"]' % manual_system.fqdn)
     row.find_element_by_link_text('Reserve Now').click()
     b.find_element_by_xpath(
         '//button[normalize-space(text())="Submit job"]').click()
     # should end up on the job page
     job_id = b.find_element_by_xpath('//h1//span[@class="job-id"]').text
     wb_descr = (WORKFLOW_DESCR % ("None", "a specific system", "86400"))
     wboard = b.find_element_by_class_name('job-whiteboard')
     self.assertIn(wb_descr,
                   wboard.text,
                   msg="Fail to match default whiteboard")
     with session.begin():
         job = TaskBase.get_by_t_id(job_id)
         cloned_job_xml = lxml.etree.tostring(
             job.to_xml(clone=True),
             encoding=unicode)  # cloning re-parses hostRequires
         self.assertIn(u'<hostRequires force="%s"/>' % manual_system.fqdn,
                       cloned_job_xml)
 def check_system_is_not_free(self, system):
     b = self.browser
     b.get(get_server_base() + 'free')
     search_for_system(b, system)
     check_system_search_results(b, absent=[system])
 def test_all_systems_included_when_no_distro_tree_selected(self):
     login(self.browser)
     b = self.browser
     go_to_reserve_systems(b, distro_tree=None)
     search_for_system(b, self.system)
     check_system_search_results(b, present=[self.system])
 def check_system_is_not_free(self, system):
     b = self.browser
     b.get(get_server_base() + 'free')
     search_for_system(b, system)
     check_system_search_results(b, absent=[system])
 def test_all_systems_included_when_no_distro_tree_selected(self):
     login(self.browser)
     b = self.browser
     go_to_reserve_systems(b, distro_tree=None)
     search_for_system(b, self.system)
     check_system_search_results(b, present=[self.system])