Esempio n. 1
0
 def test_doesnt_barf_on_xml_encoding_declaration(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''<?xml version="1.0" encoding="utf-8"?>
         <job>
             <whiteboard>job with encoding in XML declaration яяя</whiteboard>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" />
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 2
0
    def test_add_group(self):
        with session.begin():
            group = data_setup.create_group()
            user_password = '******'
            user = data_setup.create_user(password=user_password)
            data_setup.add_user_to_group(user, group)
            orig_date_modified = self.system.date_modified

        # as admin, assign the system to our test group
        b = self.browser
        login(b)
        self.go_to_system_view(tab='Groups')
        b.find_element_by_name('group.text').send_keys(group.group_name)
        b.find_element_by_name('groups').submit()
        b.find_element_by_xpath(
                '//div[@id="groups"]'
                '//td[normalize-space(text())="%s"]' % group.group_name)
        with session.begin():
            session.refresh(self.system)
            self.assert_(self.system.date_modified > orig_date_modified)

        # as a user in the group, can we see it?
        logout(b)
        login(b, user.user_name, user_password)
        click_menu_item(b, 'Systems', 'Available')
        b.find_element_by_name('simplesearch').send_keys(self.system.fqdn)
        b.find_element_by_name('systemsearch_simple').submit()
        check_system_search_results(b, present=[self.system])
Esempio n. 3
0
 def test_invalid_email_addresses_are_not_accepted_in_notify_cc(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with invalid notify cc addresses</whiteboard>
             <notify>
                 <cc>asdf</cc>
             </notify>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" role="STANDALONE"/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assertIn('Failed to import job', flash_message)
Esempio n. 4
0
 def test_invalid_email_addresses_are_not_accepted_in_notify_cc(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with invalid notify cc addresses</whiteboard>
             <notify>
                 <cc>asdf</cc>
             </notify>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" role="STANDALONE"/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assertIn('Failed to import job', flash_message)
Esempio n. 5
0
 def test_warns_about_xsd_validation_errors(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with invalid hostRequires</whiteboard>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" role="STANDALONE">
                         <params/>
                     </task>
                     <brokenElement/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     self.assertEqual(b.find_element_by_css_selector('.alert-error h4').text,
             'Job failed schema validation. Please confirm that you want to submit it.')
     b.find_element_by_xpath('//ul[@class="xsd-error-list"]/li')
     b.find_element_by_xpath('//button[text()="Queue despite validation errors"]').click()
     b.find_element_by_xpath('//title[text()="My Jobs"]')
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 6
0
 def test_doesnt_barf_on_xml_encoding_declaration(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''<?xml version="1.0" encoding="utf-8"?>
         <job>
             <whiteboard>job with encoding in XML declaration яяя</whiteboard>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" />
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 7
0
 def test_job_with_excluded_task(self):
     with session.begin():
         distro_tree = data_setup.create_distro_tree(arch=u'ia64')
         excluded_task = data_setup.create_task(exclude_arch=[u'ia64'])
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with excluded task</whiteboard>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="%s" />
                         <distro_arch op="=" value="ia64" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" role="STANDALONE">
                         <params/>
                     </task>
                     <task name="%s" role="STANDALONE">
                         <params/>
                     </task>
                 </recipe>
             </recipeSet>
         </job>
         ''' % (distro_tree.distro.name, excluded_task.name))
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 8
0
 def test_partition_without_fs_doesnt_trigger_validation_warning(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with partition without fs</whiteboard>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <partitions>
                         <partition name="/" size="4" type="part"/>
                     </partitions>
                     <task name="/distribution/install" role="STANDALONE"/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 9
0
 def test_duplicate_notify_cc_addresses_are_merged(self):
     with session.begin():
         user = data_setup.create_user(password=u'hornet')
     b = self.browser
     login(b, user.user_name, u'hornet')
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with duplicate notify cc addresses</whiteboard>
             <notify>
                 <cc>[email protected]</cc>
                 <cc>[email protected]</cc>
             </notify>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" role="STANDALONE"/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
     with session.begin():
         job = Job.query.filter(Job.owner == user).order_by(Job.id.desc()).first()
         self.assertEqual(job.cc, ['*****@*****.**'])
Esempio n. 10
0
 def test_xml_external_entities_are_rejected(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <!DOCTYPE foo [
         <!ELEMENT foo ANY >
         <!ENTITY xxe SYSTEM "file:///etc/passwd" >]>
         <job>
             <whiteboard>&xxe;</whiteboard>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install"/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     self.assertEquals(b.find_element_by_class_name('flash').text,
             'Failed to import job because of: '
             'XML entity with id file:///etc/passwd not permitted')
Esempio n. 11
0
 def test_warns_about_xsd_validation_errors(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with invalid hostRequires</whiteboard>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" role="STANDALONE">
                         <params/>
                     </task>
                     <brokenElement/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     self.assertEqual(b.find_element_by_css_selector('.alert-error h4').text,
             'Job failed schema validation. Please confirm that you want to submit it.')
     b.find_element_by_xpath('//ul[@class="xsd-error-list"]/li')
     b.find_element_by_xpath('//button[text()="Queue despite validation errors"]').click()
     b.find_element_by_xpath('//title[text()="My Jobs"]')
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 12
0
 def test_doesnt_barf_on_xmlns(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with namespace prefix declaration</whiteboard>
             <recipeSet>
                 <recipe>
                     <distroRequires xmlns:str="http://exslt.org/strings">
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" role="STANDALONE"/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 13
0
 def test_doesnt_barf_on_xmlns(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with namespace prefix declaration</whiteboard>
             <recipeSet>
                 <recipe>
                     <distroRequires xmlns:str="http://exslt.org/strings">
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" role="STANDALONE"/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 14
0
 def test_job_with_excluded_task(self):
     with session.begin():
         distro_tree = data_setup.create_distro_tree(arch=u'ia64')
         excluded_task = data_setup.create_task(exclude_arch=[u'ia64'])
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with excluded task</whiteboard>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="%s" />
                         <distro_arch op="=" value="ia64" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" role="STANDALONE">
                         <params/>
                     </task>
                     <task name="%s" role="STANDALONE">
                         <params/>
                     </task>
                 </recipe>
             </recipeSet>
         </job>
         ''' % (distro_tree.distro.name, excluded_task.name))
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 15
0
 def test_partition_without_fs_doesnt_trigger_validation_warning(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with partition without fs</whiteboard>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <partitions>
                         <partition name="/" size="4" type="part"/>
                     </partitions>
                     <task name="/distribution/install" role="STANDALONE"/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 16
0
 def test_useful_error_message_on_ksmeta_syntax_error(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with ksmeta syntax error</whiteboard>
             <recipeSet>
                 <recipe ks_meta="'">
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install"/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     self.assertEquals(b.find_element_by_class_name('flash').text,
             'Failed to import job because of: '
             'Error parsing ks_meta: No closing quotation')
Esempio n. 17
0
 def test_xml_external_entities_are_rejected(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <!DOCTYPE foo [
         <!ELEMENT foo ANY >
         <!ENTITY xxe SYSTEM "file:///etc/passwd" >]>
         <job>
             <whiteboard>&xxe;</whiteboard>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install"/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     self.assertEquals(b.find_element_by_class_name('flash').text,
             'Failed to import job because of: '
             'XML entity with id file:///etc/passwd not permitted')
Esempio n. 18
0
 def test_useful_error_message_on_ksmeta_syntax_error(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with ksmeta syntax error</whiteboard>
             <recipeSet>
                 <recipe ks_meta="'">
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install"/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     self.assertEquals(b.find_element_by_class_name('flash').text,
             'Failed to import job because of: '
             'Error parsing ks_meta: No closing quotation')
Esempio n. 19
0
 def test_duplicate_notify_cc_addresses_are_merged(self):
     with session.begin():
         user = data_setup.create_user(password=u'hornet')
     b = self.browser
     login(b, user.user_name, u'hornet')
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with duplicate notify cc addresses</whiteboard>
             <notify>
                 <cc>[email protected]</cc>
                 <cc>[email protected]</cc>
             </notify>
             <recipeSet>
                 <recipe>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" role="STANDALONE"/>
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
     with session.begin():
         job = Job.query.filter(Job.owner == user).order_by(Job.id.desc()).first()
         self.assertEqual(job.cc, ['*****@*****.**'])
Esempio n. 20
0
    def test_add_group(self):
        with session.begin():
            group = data_setup.create_group()
            user_password = '******'
            user = data_setup.create_user(password=user_password)
            data_setup.add_user_to_group(user, group)
            orig_date_modified = self.system.date_modified

        # as admin, assign the system to our test group
        b = self.browser
        login(b)
        self.go_to_system_view(tab='Groups')
        b.find_element_by_name('group.text').send_keys(group.group_name)
        b.find_element_by_name('groups').submit()
        b.find_element_by_xpath('//div[@id="groups"]'
                                '//td[normalize-space(text())="%s"]' %
                                group.group_name)
        with session.begin():
            session.refresh(self.system)
            self.assert_(self.system.date_modified > orig_date_modified)

        # as a user in the group, can we see it?
        logout(b)
        login(b, user.user_name, user_password)
        click_menu_item(b, 'Systems', 'Available')
        b.find_element_by_name('simplesearch').send_keys(self.system.fqdn)
        b.find_element_by_name('systemsearch_simple').submit()
        check_system_search_results(b, present=[self.system])
Esempio n. 21
0
 def test_mine_pools(self):
     with session.begin():
         user = data_setup.create_user(password='******')
         pool = data_setup.create_system_pool(owning_user=user)
         other_pool = data_setup.create_system_pool()
     b = self.browser
     login(b, user=user.user_name, password='******')
     b.get(get_server_base() + 'pools/')
     click_menu_item(b, 'Hello, %s' % user.user_name, 'My System Pools')
     check_pool_search_results(b, present=[pool], absent=[other_pool])
Esempio n. 22
0
 def test_mine_pools(self):
     with session.begin():
         user = data_setup.create_user(password='******')
         pool = data_setup.create_system_pool(owning_user=user)
         other_pool = data_setup.create_system_pool()
     b = self.browser
     login(b, user=user.user_name, password='******')
     b.get(get_server_base() + 'pools/')
     click_menu_item(b, 'Hello, %s' % user.user_name, 'My System Pools')
     check_pool_search_results(b, present=[pool], absent=[other_pool])
Esempio n. 23
0
 def test_recipe_not_added_to_session_too_early(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     # These bugs are triggered by related entites of Recipe (ks_appends,
     # repos, and packages) pulling the recipe into the session too early.
     # So our test job XML has one of each on the recipe and its
     # guestrecipe, to cover all cases.
     xml_file.write('''<?xml version="1.0" encoding="utf-8"?>
         <job>
             <whiteboard>job with package</whiteboard>
             <recipeSet>
                 <recipe>
                     <guestrecipe guestargs="--kvm" guestname="one">
                         <ks_appends>
                             <ks_append>append1</ks_append>
                         </ks_appends>
                         <packages>
                             <package name="package1" />
                         </packages>
                         <repos>
                             <repo name="repo1" url="http://example.com/" />
                         </repos>
                         <distroRequires>
                             <distro_name op="=" value="BlueShoeLinux5-5" />
                         </distroRequires>
                         <hostRequires/>
                         <task name="/distribution/install" />
                     </guestrecipe>
                     <ks_appends>
                         <ks_append>append2</ks_append>
                     </ks_appends>
                     <packages>
                         <package name="package2" />
                     </packages>
                     <repos>
                         <repo name="repo2" url="http://example.com/" />
                     </repos>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" />
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 24
0
 def test_recipe_not_added_to_session_too_early(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     # These bugs are triggered by related entites of Recipe (ks_appends, 
     # repos, and packages) pulling the recipe into the session too early. 
     # So our test job XML has one of each on the recipe and its 
     # guestrecipe, to cover all cases.
     xml_file.write('''<?xml version="1.0" encoding="utf-8"?>
         <job>
             <whiteboard>job with package</whiteboard>
             <recipeSet>
                 <recipe>
                     <guestrecipe guestargs="--kvm" guestname="one">
                         <ks_appends>
                             <ks_append>append1</ks_append>
                         </ks_appends>
                         <packages>
                             <package name="package1" />
                         </packages>
                         <repos>
                             <repo name="repo1" url="http://example.com/" />
                         </repos>
                         <distroRequires>
                             <distro_name op="=" value="BlueShoeLinux5-5" />
                         </distroRequires>
                         <hostRequires/>
                         <task name="/distribution/install" />
                     </guestrecipe>
                     <ks_appends>
                         <ks_append>append2</ks_append>
                     </ks_appends>
                     <packages>
                         <package name="package2" />
                     </packages>
                     <repos>
                         <repo name="repo2" url="http://example.com/" />
                     </repos>
                     <distroRequires>
                         <distro_name op="=" value="BlueShoeLinux5-5" />
                     </distroRequires>
                     <hostRequires/>
                     <task name="/distribution/install" />
                 </recipe>
             </recipeSet>
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 25
0
 def test_add_group(self):
     b = self.browser
     b.get(get_server_base())
     login(b)
     click_menu_item(b, 'Admin', 'Groups')
     b.find_element_by_link_text('Add').click()
     b.find_element_by_name('display_name').send_keys(self.group_display_name)
     b.find_element_by_name('group_name').send_keys(self.group_name)
     b.find_element_by_id('Group').submit()
     self.assertEquals(b.find_element_by_class_name('flash').text, 'OK')
     self.assert_(is_text_present(b, self.group_display_name))
Esempio n. 26
0
 def test_add_group(self):
     b = self.browser
     b.get(get_server_base())
     login(b)
     click_menu_item(b, 'Admin', 'Groups')
     b.find_element_by_link_text('Add').click()
     b.find_element_by_name('display_name').send_keys(self.group_display_name)
     b.find_element_by_name('group_name').send_keys(self.group_name)
     b.find_element_by_id('Group').submit()
     self.assertEquals(b.find_element_by_class_name('flash').text, 'OK')
     self.assert_(is_text_present(b, self.group_display_name))
Esempio n. 27
0
    def test_it(self):
        b = self.browser
        b.get(get_server_base())
        click_menu_item(b, 'Reports', 'Matrix')
        b.find_element_by_name('whiteboard_filter').send_keys(self.job_whiteboard)
        b.find_element_by_xpath('//button[text()="Filter"]').click()
        Select(b.find_element_by_name('whiteboard'))\
            .select_by_visible_text(self.job_whiteboard)
        b.find_element_by_xpath('//button[text()="Generate"]').click()

        thead = b.find_element_by_xpath(
                '//div[@class="dataTables_scrollHeadInner"]/table[1]/thead')
        self.assertEquals(thead.find_element_by_xpath('tr[1]/th[1]').text, 'Task')
        self.assertEquals(thead.find_element_by_xpath('tr[1]/th[2]').text, 'i386')
        self.assertEquals(thead.find_element_by_xpath('tr[1]/th[3]').text, 'ia64')
        self.assertEquals(thead.find_element_by_xpath('tr[1]/th[4]').text, 'x86_64')

        tbody = b.find_element_by_xpath('//table[@id="matrix_datagrid"]/tbody')
        tbody.find_element_by_xpath('.//td[normalize-space(string(.))="Pass: 1"]')
        tbody.find_element_by_xpath('.//td[normalize-space(string(.))="Warn: 1"]')
        tbody.find_element_by_xpath('.//td[normalize-space(string(.))="Fail: 1"]')

        self.assertEquals(thead.find_element_by_xpath('tr[2]/th[2]').text,
                self.recipe_whiteboard)
        self.assertEquals(thead.find_element_by_xpath('tr[2]/th[3]').text,
                self.recipe_whiteboard)
        self.assertEquals(thead.find_element_by_xpath('tr[2]/th[4]').text,
                self.recipe_whiteboard)

        b.find_element_by_link_text('Pass: 1').click()
        b.find_element_by_xpath('//title[text()="Executed Tasks"]')
        self.assertEquals(b.find_element_by_name('whiteboard').get_attribute('value'),
                self.recipe_whiteboard)
        self.assertEquals(
                b.find_element_by_xpath('//table/tbody/tr[1]/td[1]').text,
                self.passed_job.recipesets[0].recipes[0].tasks[0].t_id)
        b.back()

        b.find_element_by_link_text('Warn: 1').click()
        b.find_element_by_xpath('//title[text()="Executed Tasks"]')
        self.assertEquals(b.find_element_by_name('whiteboard').get_attribute('value'),
                self.recipe_whiteboard)
        self.assertEquals(
                b.find_element_by_xpath('//table/tbody/tr[1]/td[1]').text,
                self.warned_job.recipesets[0].recipes[0].tasks[0].t_id)
        b.back()

        b.find_element_by_link_text('Fail: 1').click()
        b.find_element_by_xpath('//title[text()="Executed Tasks"]')
        self.assertEquals(b.find_element_by_name('whiteboard').get_attribute('value'),
                self.recipe_whiteboard)
        self.assertEquals(
                b.find_element_by_xpath('//table/tbody/tr[1]/td[1]').text,
                self.failed_job.recipesets[0].recipes[0].tasks[0].t_id)
Esempio n. 28
0
    def test_it(self):
        b = self.browser
        b.get(get_server_base())
        click_menu_item(b, 'Reports', 'Matrix')
        b.find_element_by_name('whiteboard_filter').send_keys(self.job_whiteboard)
        b.find_element_by_xpath('//button[text()="Filter"]').click()
        Select(b.find_element_by_name('whiteboard'))\
            .select_by_visible_text(self.job_whiteboard)
        b.find_element_by_xpath('//button[text()="Generate"]').click()

        thead = b.find_element_by_xpath(
                '//div[@class="dataTables_scrollHeadInner"]/table[1]/thead')
        self.assertEquals(thead.find_element_by_xpath('tr[1]/th[1]').text, 'Task')
        self.assertEquals(thead.find_element_by_xpath('tr[1]/th[2]').text, 'i386')
        self.assertEquals(thead.find_element_by_xpath('tr[1]/th[3]').text, 'ia64')
        self.assertEquals(thead.find_element_by_xpath('tr[1]/th[4]').text, 'x86_64')

        tbody = b.find_element_by_xpath('//table[@id="matrix_datagrid"]/tbody')
        tbody.find_element_by_xpath('.//td[normalize-space(string(.))="Pass: 1"]')
        tbody.find_element_by_xpath('.//td[normalize-space(string(.))="Warn: 1"]')
        tbody.find_element_by_xpath('.//td[normalize-space(string(.))="Fail: 1"]')

        self.assertEquals(thead.find_element_by_xpath('tr[2]/th[2]').text,
                self.recipe_whiteboard)
        self.assertEquals(thead.find_element_by_xpath('tr[2]/th[3]').text,
                self.recipe_whiteboard)
        self.assertEquals(thead.find_element_by_xpath('tr[2]/th[4]').text,
                self.recipe_whiteboard)

        b.find_element_by_link_text('Pass: 1').click()
        b.find_element_by_xpath('//title[text()="Executed Tasks"]')
        self.assertEquals(b.find_element_by_name('whiteboard').get_attribute('value'),
                self.recipe_whiteboard)
        self.assertEquals(
                b.find_element_by_xpath('//table/tbody/tr[1]/td[1]').text,
                self.passed_job.recipesets[0].recipes[0].tasks[0].t_id)
        b.back()

        b.find_element_by_link_text('Warn: 1').click()
        b.find_element_by_xpath('//title[text()="Executed Tasks"]')
        self.assertEquals(b.find_element_by_name('whiteboard').get_attribute('value'),
                self.recipe_whiteboard)
        self.assertEquals(
                b.find_element_by_xpath('//table/tbody/tr[1]/td[1]').text,
                self.warned_job.recipesets[0].recipes[0].tasks[0].t_id)
        b.back()

        b.find_element_by_link_text('Fail: 1').click()
        b.find_element_by_xpath('//title[text()="Executed Tasks"]')
        self.assertEquals(b.find_element_by_name('whiteboard').get_attribute('value'),
                self.recipe_whiteboard)
        self.assertEquals(
                b.find_element_by_xpath('//table/tbody/tr[1]/td[1]').text,
                self.failed_job.recipesets[0].recipes[0].tasks[0].t_id)
Esempio n. 29
0
    def test_valid_job_xml_doesnt_trigger_xsd_warning(self):
        with session.begin():
            group = data_setup.create_group(group_name='somegroup')
            user = data_setup.create_user(password=u'hornet')
            user.groups.append(group)

        b = self.browser
        login(b, user=user.user_name, password='******')
        b.get(get_server_base())
        click_menu_item(b, 'Scheduler', 'New Job')
        b.find_element_by_id('jobs_filexml').send_keys(
                pkg_resources.resource_filename('bkr.inttest', 'complete-job.xml'))
        b.find_element_by_xpath('//button[text()="Submit Data"]').click()
        b.find_element_by_xpath('//button[text()="Queue"]').click()
        flash_message = b.find_element_by_class_name('flash').text
        self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 30
0
    def test_valid_job_xml_doesnt_trigger_xsd_warning(self):
        with session.begin():
            group = data_setup.create_group(group_name='somegroup')
            user = data_setup.create_user(password=u'hornet')
            user.groups.append(group)

        b = self.browser
        login(b, user=user.user_name, password='******')
        b.get(get_server_base())
        click_menu_item(b, 'Scheduler', 'New Job')
        b.find_element_by_id('jobs_filexml').send_keys(
            pkg_resources.resource_filename('bkr.inttest', 'complete-job.xml'))
        b.find_element_by_xpath('//button[text()="Submit Data"]').click()
        b.find_element_by_xpath('//button[text()="Queue"]').click()
        flash_message = b.find_element_by_class_name('flash').text
        self.assert_(flash_message.startswith('Success!'), flash_message)
Esempio n. 31
0
 def test_refuses_to_accept_unparseable_xml(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with unterminated whiteboard
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assertIn('Failed to import job', flash_message)
Esempio n. 32
0
 def test_refuses_to_accept_unparseable_xml(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Scheduler', 'New Job')
     xml_file = tempfile.NamedTemporaryFile()
     xml_file.write('''
         <job>
             <whiteboard>job with unterminated whiteboard
         </job>
         ''')
     xml_file.flush()
     b.find_element_by_id('jobs_filexml').send_keys(xml_file.name)
     b.find_element_by_xpath('//button[text()="Submit Data"]').click()
     b.find_element_by_xpath('//button[text()="Queue"]').click()
     flash_message = b.find_element_by_class_name('flash').text
     self.assertIn('Failed to import job', flash_message)
Esempio n. 33
0
    def test_adduser(self):
        user_1_name = data_setup.unique_name('anonymous%s')
        user_1_email = data_setup.unique_name('*****@*****.**')
        user_1_pass = '******'

        user_2_name = data_setup.unique_name('anonymous%s')
        user_2_email = data_setup.unique_name('*****@*****.**')
        user_2_pass = '******'

        b = self.browser
        b.get(get_server_base())
        click_menu_item(b, 'Admin', 'Accounts')
        b.find_element_by_link_text('Add').click()
        b.find_element_by_name('user_name').send_keys(user_1_name)
        b.find_element_by_name('display_name').send_keys(user_1_name)
        b.find_element_by_name('email_address').send_keys(user_1_email)
        b.find_element_by_name('password').send_keys(user_1_pass)
        b.find_element_by_id('User').submit()
        #Test Saved message came up
        self.assertEquals(
            b.find_element_by_class_name('flash').text,
            '%s saved' % user_1_name)

        b.get(get_server_base() + 'users')
        #Test that user 1 is listed as part of users
        self.failUnless(is_text_present(b, user_1_name))

        #Add user 2
        b.find_element_by_link_text('Add').click()
        b.find_element_by_name('user_name').send_keys(user_2_name)
        b.find_element_by_name('display_name').send_keys(user_2_name)
        b.find_element_by_name('email_address').send_keys(user_2_email)
        b.find_element_by_name('password').send_keys(user_2_pass)
        b.find_element_by_id('User').submit()
        #Test Saved message came up
        self.assertEquals(
            b.find_element_by_class_name('flash').text,
            '%s saved' % user_2_name)

        b.get(get_server_base() + 'users')
        #Test that user 2 is listed as part of users
        self.failUnless(is_text_present(b, user_2_name))
Esempio n. 34
0
    def test_non_ascii_username_and_display_name(self):
        user_name = u"ломоносов"
        display_name = u"Михаил Ломоносов"
        email = "*****@*****.**"
        b = self.browser
        b.get(get_server_base())
        click_menu_item(b, "Admin", "Accounts")
        b.find_element_by_link_text("Add").click()
        b.find_element_by_name("user_name").send_keys(user_name)
        b.find_element_by_name("display_name").send_keys(display_name)
        b.find_element_by_name("email_address").send_keys(email)
        b.find_element_by_tag_name("form").submit()
        self.assertEquals(b.find_element_by_class_name("flash").text, "%s saved" % display_name)

        # Test that autocomplete and search work as well
        b.find_element_by_name("user.text").send_keys(u"ломо")
        b.find_element_by_xpath(u'//span[@id="autoCompleteResultsSearch_user"]' u'//td[string(.)="ломоносов"]')
        b.find_element_by_name("user.text").send_keys(u"носов")
        b.find_element_by_xpath('//button[text()="Search"]').click()
        b.find_element_by_xpath(u"//table/tbody/tr[1]" u'/td[normalize-space(string(.))="ломоносов"]')
Esempio n. 35
0
    def test_disable(self):
        user_pass = '******'
        user_name = 'disabled'
        email = '*****@*****.**'

        b = self.browser
        b.get(get_server_base())
        click_menu_item(b, 'Admin', 'Accounts')
        b.find_element_by_link_text('Add').click()
        b.find_element_by_name('user_name').send_keys(user_name)
        b.find_element_by_name('display_name').send_keys(user_name)
        b.find_element_by_name('email_address').send_keys(email)
        b.find_element_by_name('password').send_keys(user_pass)
        b.find_element_by_id('User').submit()
        #Test Saved message came up
        self.assertEquals(
            b.find_element_by_class_name('flash').text, '%s saved' % user_name)
        logout(b)

        # First verify you can login as user.
        login(b, user=user_name, password=user_pass)
        logout(b)

        # Login as admin and disable user TEST 1
        login(b)
        b.get(get_server_base())
        click_menu_item(b, 'Admin', 'Accounts')
        b.find_element_by_link_text(user_name).click()
        b.find_element_by_name('disabled').click()
        b.find_element_by_id('User').submit()
        self.assertEquals(
            b.find_element_by_class_name('flash').text, '%s saved' % user_name)
        logout(b)

        # Try and login as Disabled User
        login(b, user=user_name, password=user_pass)
        self.failUnless(
            is_text_present(
                b,
                "The credentials you supplied were not correct or did not grant access to this resource"
            ))
Esempio n. 36
0
    def test_adduser(self):
        user_1_name = data_setup.unique_name('anonymous%s')
        user_1_email = data_setup.unique_name('*****@*****.**')
        user_1_pass = '******'

        user_2_name = data_setup.unique_name('anonymous%s')
        user_2_email = data_setup.unique_name('*****@*****.**')
        user_2_pass = '******'

        b = self.browser
        b.get(get_server_base())
        click_menu_item(b, 'Admin', 'Accounts')
        b.find_element_by_link_text('Add').click()
        b.find_element_by_name('user_name').send_keys(user_1_name)
        b.find_element_by_name('display_name').send_keys(user_1_name)
        b.find_element_by_name('email_address').send_keys(user_1_email)
        b.find_element_by_name('password').send_keys(user_1_pass)
        b.find_element_by_id('User').submit()
        #Test Saved message came up
        self.assertEquals(b.find_element_by_class_name('flash').text,
                '%s saved' % user_1_name)

        b.get(get_server_base() + 'users')
        #Test that user 1 is listed as part of users
        self.failUnless(is_text_present(b, user_1_name))

        #Add user 2
        b.find_element_by_link_text('Add').click()
        b.find_element_by_name('user_name').send_keys(user_2_name)
        b.find_element_by_name('display_name').send_keys(user_2_name)
        b.find_element_by_name('email_address').send_keys(user_2_email)
        b.find_element_by_name('password').send_keys(user_2_pass)
        b.find_element_by_id('User').submit()
        #Test Saved message came up
        self.assertEquals(b.find_element_by_class_name('flash').text,
                '%s saved' % user_2_name)

        b.get(get_server_base() + 'users')
        #Test that user 2 is listed as part of users
        self.failUnless(is_text_present(b, user_2_name))
Esempio n. 37
0
 def test_my_menu(self):
     b = self.browser
     login(b)
     click_menu_item(b, 'Hello, %s' % data_setup.ADMIN_USER, 'My Jobs')
     b.find_element_by_xpath('//title[text()="My Jobs"]')
     click_menu_item(b, 'Hello, %s' % data_setup.ADMIN_USER, 'My Recipes')
     b.find_element_by_xpath('//title[text()="Recipes"]')
     click_menu_item(b, 'Hello, %s' % data_setup.ADMIN_USER, 'My Systems')
     b.find_element_by_xpath('//title[text()="My Systems"]')
     click_menu_item(b, 'Hello, %s' % data_setup.ADMIN_USER, 'My Groups')
     b.find_element_by_xpath('//title[text()="Groups"]')
     self.assertEqual(
         b.find_element_by_class_name('search-query').get_attribute(
             'value'), 'member.user_name:%s' % data_setup.ADMIN_USER)
Esempio n. 38
0
    def test_adduser(self):
        user_1_name = data_setup.unique_name("anonymous%s")
        user_1_email = data_setup.unique_name("*****@*****.**")
        user_1_pass = "******"

        user_2_name = data_setup.unique_name("anonymous%s")
        user_2_email = data_setup.unique_name("*****@*****.**")
        user_2_pass = "******"

        b = self.browser
        b.get(get_server_base())
        click_menu_item(b, "Admin", "Accounts")
        b.find_element_by_link_text("Add").click()
        b.find_element_by_name("user_name").send_keys(user_1_name)
        b.find_element_by_name("display_name").send_keys(user_1_name)
        b.find_element_by_name("email_address").send_keys(user_1_email)
        b.find_element_by_name("password").send_keys(user_1_pass)
        b.find_element_by_id("User").submit()
        # Test Saved message came up
        self.assertEquals(b.find_element_by_class_name("flash").text, "%s saved" % user_1_name)

        b.get(get_server_base() + "users")
        # Test that user 1 is listed as part of users
        self.failUnless(is_text_present(b, user_1_name))

        # Add user 2
        b.find_element_by_link_text("Add").click()
        b.find_element_by_name("user_name").send_keys(user_2_name)
        b.find_element_by_name("display_name").send_keys(user_2_name)
        b.find_element_by_name("email_address").send_keys(user_2_email)
        b.find_element_by_name("password").send_keys(user_2_pass)
        b.find_element_by_id("User").submit()
        # Test Saved message came up
        self.assertEquals(b.find_element_by_class_name("flash").text, "%s saved" % user_2_name)

        b.get(get_server_base() + "users")
        # Test that user 2 is listed as part of users
        self.failUnless(is_text_present(b, user_2_name))
Esempio n. 39
0
    def test_disable(self):
        user_pass = '******'
        user_name = 'disabled'
        email = '*****@*****.**'

        b = self.browser
        b.get(get_server_base())
        click_menu_item(b, 'Admin', 'Accounts')
        b.find_element_by_link_text('Add').click()
        b.find_element_by_name('user_name').send_keys(user_name)
        b.find_element_by_name('display_name').send_keys(user_name)
        b.find_element_by_name('email_address').send_keys(email)
        b.find_element_by_name('password').send_keys(user_pass)
        b.find_element_by_id('User').submit()
        #Test Saved message came up
        self.assertEquals(b.find_element_by_class_name('flash').text,
                '%s saved' % user_name)
        logout(b)

        # First verify you can login as user.
        login(b, user=user_name, password=user_pass)
        logout(b)

        # Login as admin and disable user TEST 1
        login(b)
        b.get(get_server_base())
        click_menu_item(b, 'Admin', 'Accounts')
        b.find_element_by_link_text(user_name).click()
        b.find_element_by_name('disabled').click()
        b.find_element_by_id('User').submit()
        self.assertEquals(b.find_element_by_class_name('flash').text,
                '%s saved' % user_name)
        logout(b)

        # Try and login as Disabled User
        login(b, user=user_name, password=user_pass)
        self.failUnless(is_text_present(b, "The credentials you supplied were not correct or did not grant access to this resource" ))
Esempio n. 40
0
    def test_disable(self):
        user_pass = "******"
        user_name = "disabled"
        email = "*****@*****.**"

        b = self.browser
        b.get(get_server_base())
        click_menu_item(b, "Admin", "Accounts")
        b.find_element_by_link_text("Add").click()
        b.find_element_by_name("user_name").send_keys(user_name)
        b.find_element_by_name("display_name").send_keys(user_name)
        b.find_element_by_name("email_address").send_keys(email)
        b.find_element_by_name("password").send_keys(user_pass)
        b.find_element_by_id("User").submit()
        # Test Saved message came up
        self.assertEquals(b.find_element_by_class_name("flash").text, "%s saved" % user_name)
        logout(b)

        # First verify you can login as user.
        login(b, user=user_name, password=user_pass)
        logout(b)

        # Login as admin and disable user TEST 1
        login(b)
        b.get(get_server_base())
        click_menu_item(b, "Admin", "Accounts")
        b.find_element_by_link_text(user_name).click()
        b.find_element_by_name("disabled").click()
        b.find_element_by_id("User").submit()
        self.assertEquals(b.find_element_by_class_name("flash").text, "%s saved" % user_name)
        logout(b)

        # Try and login as Disabled User
        login(b, user=user_name, password=user_pass)
        self.failUnless(
            is_text_present(b, "The credentials you supplied were not correct or did not grant access to this resource")
        )
Esempio n. 41
0
 def test_my_menu(self):
     b = self.browser
     login(b)
     click_menu_item(b, 'Hello, %s' % data_setup.ADMIN_USER, 'My Jobs')
     b.find_element_by_xpath('//title[text()="My Jobs"]')
     click_menu_item(b, 'Hello, %s' % data_setup.ADMIN_USER, 'My Recipes')
     b.find_element_by_xpath('//title[text()="Recipes"]')
     click_menu_item(b, 'Hello, %s' % data_setup.ADMIN_USER, 'My Systems')
     b.find_element_by_xpath('//title[text()="My Systems"]')
Esempio n. 42
0
    def test_non_ascii_username_and_display_name(self):
        user_name = u'ломоносов'
        display_name = u'Михаил Ломоносов'
        email = '*****@*****.**'
        b = self.browser
        b.get(get_server_base())
        click_menu_item(b, 'Admin', 'Accounts')
        b.find_element_by_link_text('Add').click()
        b.find_element_by_name('user_name').send_keys(user_name)
        b.find_element_by_name('display_name').send_keys(display_name)
        b.find_element_by_name('email_address').send_keys(email)
        b.find_element_by_tag_name('form').submit()
        self.assertEquals(
            b.find_element_by_class_name('flash').text,
            '%s saved' % display_name)

        # Test that autocomplete and search work as well
        b.find_element_by_name('user.text').send_keys(u'ломо')
        b.find_element_by_xpath(u'//span[@id="autoCompleteResultsSearch_user"]'
                                u'//td[string(.)="ломоносов"]')
        b.find_element_by_name('user.text').send_keys(u'носов')
        b.find_element_by_xpath('//button[text()="Search"]').click()
        b.find_element_by_xpath(u'//table/tbody/tr[1]'
                                u'/td[normalize-space(string(.))="ломоносов"]')
Esempio n. 43
0
 def test_itemcount(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Systems', 'All')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
     click_menu_item(b, 'Systems', 'Available')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
     click_menu_item(b, 'Systems', 'Free')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
     click_menu_item(b, 'Devices', 'All')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
     click_menu_item(b, 'Distros', 'All')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
     click_menu_item(b, 'Scheduler', 'Jobs')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
     click_menu_item(b, 'Scheduler', 'Task Library')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
Esempio n. 44
0
 def test_itemcount(self):
     b = self.browser
     login(b)
     b.get(get_server_base())
     click_menu_item(b, 'Systems', 'All')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
     click_menu_item(b, 'Systems', 'Available')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
     click_menu_item(b, 'Systems', 'Free')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
     click_menu_item(b, 'Devices', 'All')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
     click_menu_item(b, 'Distros', 'All')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
     click_menu_item(b, 'Scheduler', 'Jobs')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
     click_menu_item(b, 'Scheduler', 'Task Library')
     b.find_element_by_xpath('//span[contains(text(), "Items found:")]')
Esempio n. 45
0
    def test_menulist(self):
        b = self.browser
        b.get(get_server_base())

        click_menu_item(b, 'Systems', 'All')
        b.find_element_by_xpath('//title[text()="Systems"]')
        click_menu_item(b, 'Hello, %s' % data_setup.ADMIN_USER, 'My Systems')
        b.find_element_by_xpath('//title[text()="My Systems"]')
        click_menu_item(b, 'Systems', 'Available')
        b.find_element_by_xpath('//title[text()="Available Systems"]')
        click_menu_item(b, 'Systems', 'Free')
        b.find_element_by_xpath('//title[text()="Free Systems"]')
        click_menu_item(b, 'Devices', 'All')
        b.find_element_by_xpath('//title[text()="Devices"]')
        click_menu_item(b, 'Devices', 'IDE')
        b.find_element_by_xpath('//title[text()="Devices"]')
        click_menu_item(b, 'Distros', 'Family')
        b.find_element_by_xpath('//title[text()="OS Versions"]')
        click_menu_item(b, 'Scheduler', 'New Job')
        b.find_element_by_xpath('//title[text()="New Job"]')
        click_menu_item(b, 'Scheduler', 'Watchdog')
        b.find_element_by_xpath('//title[text()="Watchdogs"]')
        click_menu_item(b, 'Activity', 'All')
        b.find_element_by_xpath('//title[text()="Activity"]')
        click_menu_item(b, 'Activity', 'Systems')
        b.find_element_by_xpath('//title[text()="System Activity"]')
        click_menu_item(b, 'Activity', 'Distros')
        b.find_element_by_xpath('//title[text()="Distro Activity"]')
    def test_menulist(self):
        b = self.browser
        b.get(get_server_base())

        click_menu_item(b, "Systems", "All")
        b.find_element_by_xpath('//title[text()="Systems"]')
        click_menu_item(b, "Hello, %s" % data_setup.ADMIN_USER, "My Systems")
        b.find_element_by_xpath('//title[text()="My Systems"]')
        click_menu_item(b, "Systems", "Available")
        b.find_element_by_xpath('//title[text()="Available Systems"]')
        click_menu_item(b, "Systems", "Free")
        b.find_element_by_xpath('//title[text()="Free Systems"]')
        click_menu_item(b, "Systems", "Reserve")
        b.find_element_by_xpath('//title[text()="Reserve Workflow"]')
        click_menu_item(b, "Devices", "All")
        b.find_element_by_xpath('//title[text()="Devices"]')
        click_menu_item(b, "Devices", "IDE")
        b.find_element_by_xpath('//title[text()="Devices"]')
        click_menu_item(b, "Distros", "Family")
        b.find_element_by_xpath('//title[text()="OS Versions"]')
        click_menu_item(b, "Scheduler", "New Job")
        b.find_element_by_xpath('//title[text()="New Job"]')
        click_menu_item(b, "Scheduler", "Watchdog")
        b.find_element_by_xpath('//title[text()="Watchdogs"]')
        click_menu_item(b, "Activity", "All")
        b.find_element_by_xpath('//title[text()="Activity"]')
        click_menu_item(b, "Activity", "Systems")
        b.find_element_by_xpath('//title[text()="System Activity"]')
        click_menu_item(b, "Activity", "Distros")
        b.find_element_by_xpath('//title[text()="Distro Activity"]')