def test_cloning_recipeset_from_job_with_product(self): with session.begin(): job = data_setup.create_job() job.retention_tag = RetentionTag.list_by_requires_product()[0] job.product = Product(u'product_name') b = self.browser login(b) b.get(get_server_base() + 'jobs/clone?job_id=%s' % job.id) cloned_from_job = b.find_element_by_xpath('//textarea[@name="textxml"]').text b.get(get_server_base() + 'jobs/clone?recipeset_id=%s' % job.recipesets[0].id) cloned_from_rs = b.find_element_by_xpath('//textarea[@name="textxml"]').text self.assertEqual(cloned_from_job,cloned_from_rs)
def test_search_product(self): with session.begin(): my_job = data_setup.create_job() new_product = Product(name=data_setup.unique_name('myproduct%s')) my_job.product = new_product b = self.browser # Test with product. b.get(get_server_base() + 'jobs') b.find_element_by_link_text('Show Search Options').click() b.find_element_by_xpath("//select[@id='jobsearch_0_table'] \ /option[@value='Product']").click() b.find_element_by_xpath("//select[@id='jobsearch_0_operation'] \ /option[@value='is']").click() b.find_element_by_xpath("//select[@id='jobsearch_0_value']/" "option[normalize-space(text())='%s']" % new_product.name).click() b.find_element_by_id('searchform').submit() job_search_result = \ b.find_element_by_xpath('//table[@id="widget"]').text self.assert_('J:%s' % my_job.id in job_search_result) with session.begin(): my_job.product = None # Test without product b.find_element_by_xpath("//select[@id='jobsearch_0_table'] \ /option[@value='Product']").click() b.find_element_by_xpath("//select[@id='jobsearch_0_operation'] \ /option[@value='is']").click() b.find_element_by_xpath( "//select[@id='jobsearch_0_value']/" "option[normalize-space(text())='None']").click() b.find_element_by_link_text('Add').click() b.find_element_by_xpath("//select[@id='jobsearch_1_table'] \ /option[@value='Id']").click() b.find_element_by_xpath("//select[@id='jobsearch_1_operation'] \ /option[@value='is']").click() b.find_element_by_xpath("//input[@id='jobsearch_1_value']"). \ send_keys(str(my_job.id)) b.find_element_by_id('searchform').submit() job_search_result = \ b.find_element_by_xpath('//table[@id="widget"]').text self.assert_('J:%s' % my_job.id in job_search_result)