def setUp(self): self.browser = self.get_browser() with session.begin(): self.user = data_setup.create_user(password=u'password') if not Distro.by_name(u'BlueShoeLinux5-5'): data_setup.create_distro_tree(distro_name=u'BlueShoeLinux5-5') data_setup.create_product(product_name=u'the_product')
def setUp(self): data_setup.create_product(product_name=u'the_product') data_setup.create_group(group_name=u'somegroup') self.user_foo = data_setup.create_user(password=u'foo') self.user_bar = data_setup.create_user(password=u'bar') self.bot = data_setup.create_user(password=u'bot') # Add bot as delegate submission of foo self.user_foo.add_submission_delegate(self.bot, service=u'testdata')
def test_job_owner_can_change_product(self): with session.begin(): job_owner = data_setup.create_user(password=u'owner') job = data_setup.create_job(owner=job_owner, retention_tag=u'active', product=data_setup.create_product()) new_product = data_setup.create_product() login(self.browser, user=job_owner.user_name, password=u'owner') self.check_can_change_product(job, new_product)
def setUp(self): from bkr.server.jobs import Jobs self.controller = Jobs() self.user = data_setup.create_user() group = data_setup.create_group(group_name='somegroup') self.user.groups.append(group) testutil.set_identity_user(self.user) data_setup.create_distro_tree(distro_name=u'BlueShoeLinux5-5') data_setup.create_product(product_name=u'the_product')
def setUp(self): session.begin() from bkr.server.jobs import Jobs self.controller = Jobs() self.user = data_setup.create_user(user_name=u'test-job-owner', email_address=u'*****@*****.**') group = data_setup.create_group(group_name='somegroup') group.add_member(self.user) testutil.set_identity_user(self.user) data_setup.create_product(product_name=u'the_product') session.flush()
def setUp(self): from bkr.server.jobs import Jobs self.controller = Jobs() self.user = data_setup.create_user() group = data_setup.create_group(group_name="somegroup") self.user.groups.append(group) testutil.set_identity_user(self.user) if not Distro.by_name(u"BlueShoeLinux5-5"): data_setup.create_distro_tree(distro_name=u"BlueShoeLinux5-5") data_setup.create_product(product_name=u"the_product")
def setUp(self): session.begin() from bkr.server.jobs import Jobs self.controller = Jobs() self.user = data_setup.create_user( user_name=u'test-job-owner', email_address=u'*****@*****.**') group = data_setup.create_group(group_name='somegroup') group.add_member(self.user) testutil.set_identity_user(self.user) data_setup.create_product(product_name=u'the_product') session.flush()
def test_group_member_can_change_product(self): with session.begin(): group = data_setup.create_group() job_owner = data_setup.create_user() group_member = data_setup.create_user(password=u'group_member') data_setup.add_user_to_group(job_owner, group) data_setup.add_user_to_group(group_member, group) job = data_setup.create_job(owner=job_owner, retention_tag=u'active', product=data_setup.create_product()) new_product = data_setup.create_product() login(self.browser, user=group_member.user_name, password=u'group_member') self.check_can_change_product(job, new_product)
def test_product_ordering(self): with session.begin(): job = data_setup.create_job() product_before = data_setup.create_product() product_after = data_setup.create_product() b = self.browser b.get(get_server_base() + 'jobs/%s' % job.id) product_select = b.find_element_by_xpath('//select[@id="job_product"]') options = [option.text for option in product_select.find_elements_by_tag_name('option')] before_pos = options.index(product_before.name) after_pos = options.index(product_after.name) self.assertLess(before_pos, after_pos)
def setupClass(cls): with session.begin(): cls.product_one = data_setup.create_product() cls.product_two = data_setup.create_product() cls.distro_tree = data_setup.create_distro_tree(osmajor=u'customosmajor') cls.password = u'password' cls.user = data_setup.create_user(password=cls.password) cls.scratch_job = data_setup.create_completed_job( retention_tag=u'scratch', owner=cls.user, product=cls.product_one, distro_tree=cls.distro_tree) cls.sixty_days_job = data_setup.create_completed_job( retention_tag=u'60Days', product=cls.product_two, owner=cls.user) cls.server = cls.get_server() cls.server.auth.login_password(cls.user.user_name, cls.password)
def test_product_ordering(self): with session.begin(): job = data_setup.create_job() product_before = data_setup.create_product() product_after = data_setup.create_product() b = self.browser b.get(get_server_base() + 'jobs/%s' % job.id) product_select = b.find_element_by_xpath('//select[@id="job_product"]') options = [ option.text for option in product_select.find_elements_by_tag_name('option') ] before_pos = options.index(product_before.name) after_pos = options.index(product_after.name) self.assertLess(before_pos, after_pos)
def test_other_user_cannot_change_product(self): with session.begin(): other_user = data_setup.create_user(password=u'other_user') job = data_setup.create_job(retention_tag=u'active', product=data_setup.create_product()) login(self.browser, user=other_user.user_name, password=u'other_user') self.check_cannot_change_product(job)
def setUp(self): jobs_to_generate = 2 self.products = [ data_setup.create_product() for _ in range(jobs_to_generate) ] self.users = [ data_setup.create_user(password='******') for _ in range(jobs_to_generate) ] self.groups = [ data_setup.create_group() for _ in range(jobs_to_generate) ] _ = [ group.add_member(self.users[i]) for i, group in enumerate(self.groups) ] self.jobs = [ data_setup.create_completed_job(product=self.products[x], owner=self.users[x], group=self.groups[x]) for x in range(jobs_to_generate) ] self.client_configs = [ create_client_config(username=user.user_name, password='******') for user in self.users ]
def setUp(self): jobs_to_generate = 2 self.products = [data_setup.create_product() for product in range(jobs_to_generate)] self.users = [data_setup.create_user(password="******") for user in range(jobs_to_generate)] self.jobs = [ data_setup.create_completed_job(product=self.products[x], owner=self.users[x]) for x in range(jobs_to_generate) ] self.client_configs = [create_client_config(username=user.user_name, password="******") for user in self.users]
def setUpClass(cls): with session.begin(): cls.product_one = data_setup.create_product() cls.product_two = data_setup.create_product() cls.distro_tree = data_setup.create_distro_tree( osmajor=u'customosmajor') cls.password = u'password' cls.user = data_setup.create_user(password=cls.password) cls.scratch_job = data_setup.create_completed_job( retention_tag=u'scratch', owner=cls.user, product=cls.product_one, distro_tree=cls.distro_tree) cls.sixty_days_job = data_setup.create_completed_job( retention_tag=u'60Days', product=cls.product_two, owner=cls.user) cls.server = cls.get_server() cls.server.auth.login_password(cls.user.user_name, cls.password)
def test_change_retention_tag_clearing_product(self): with session.begin(): job_owner = data_setup.create_user(password=u'owner') job = data_setup.create_job(owner=job_owner, retention_tag=u'active', product=data_setup.create_product()) login(self.browser, user=job_owner.user_name, password=u'owner') b = self.browser b.get(get_server_base() + 'jobs/%s' % job.id) Select(b.find_element_by_id('job_retentiontag'))\ .select_by_visible_text('scratch') b.find_element_by_xpath('//button[text()="Clear product"]').click() b.find_element_by_xpath('//div[text()="Tag has been updated"]')
def test_list_jobs_by_retention_tag(self): with session.begin(): job_tagged_scratch = data_setup.create_completed_job( retention_tag=u'scratch') job_tagged_audit = data_setup.create_completed_job( retention_tag=u'audit', product=data_setup.create_product()) out = run_client(['bkr', 'job-list', '--format=json', '--tag=audit']) joblist = json.loads(out) self.assertIn(job_tagged_audit.t_id, joblist) self.assertNotIn(job_tagged_scratch.t_id, joblist) out = run_client(['bkr', 'job-list', '--format=json', '--tag=scratch']) joblist = json.loads(out) self.assertIn(job_tagged_scratch.t_id, joblist) self.assertNotIn(job_tagged_audit.t_id, joblist)
def test_list_jobs_by_retention_tag(self): with session.begin(): job_tagged_scratch = data_setup.create_completed_job(retention_tag=u"scratch") job_tagged_audit = data_setup.create_completed_job( retention_tag=u"audit", product=data_setup.create_product() ) out = run_client(["bkr", "job-list", "--format=json", "--tag=audit"]) joblist = json.loads(out) self.assertIn(job_tagged_audit.t_id, joblist) self.assertNotIn(job_tagged_scratch.t_id, joblist) out = run_client(["bkr", "job-list", "--format=json", "--tag=scratch"]) joblist = json.loads(out) self.assertIn(job_tagged_scratch.t_id, joblist) self.assertNotIn(job_tagged_audit.t_id, joblist)
def setUp(self): jobs_to_generate = 2 self.products = [ data_setup.create_product() for product in range(jobs_to_generate) ] self.users = [ data_setup.create_user(password='******') for user in range(jobs_to_generate) ] self.jobs = [ data_setup.create_completed_job(product=self.products[x], owner=self.users[x]) for x in range(jobs_to_generate) ] self.client_configs = [ create_client_config(username=user.user_name, password='******') for user in self.users ]
def test_retention_tag_product(self): with session.begin(): rt1 = data_setup.create_retention_tag() rt2 = data_setup.create_retention_tag(needs_product=True) p1 = data_setup.create_product() out = run_client(['bkr', 'job-modify', self.job.t_id, '--retention-tag', '%s' % rt1.tag]) self.assert_(out == 'Successfully modified jobs %s\n' % self.job.t_id) session.expunge_all() j = TaskBase.get_by_t_id(self.job.t_id) self.assert_(j.retention_tag.tag == rt1.tag) out = run_client(['bkr', 'job-modify', self.job.t_id, '--retention-tag', '%s' % rt2.tag, '--product', '%s' % p1.name]) self.assert_(out == 'Successfully modified jobs %s\n' % self.job.t_id) session.expunge_all() j = TaskBase.get_by_t_id(self.job.t_id) self.assert_(j.retention_tag.tag == rt2.tag) self.assert_(j.product.name == p1.name) out = run_client(['bkr', 'job-modify', self.job.t_id, '--retention-tag', '%s' % rt1.tag, '--product=']) self.assert_(out == 'Successfully modified jobs %s\n' % self.job.t_id) session.expunge_all() j = TaskBase.get_by_t_id(self.job.t_id) self.assert_(j.retention_tag.tag == rt1.tag) self.assert_(j.product is None)
def setUp(self): data_setup.create_distro_tree(distro_name=u'BlueShoeLinux5-5') data_setup.create_product(product_name=u'the_product') self.browser = self.get_browser()
def setUp(self): self.browser = self.get_browser() with session.begin(): self.user = data_setup.create_user(password=u'password') data_setup.create_distro_tree(distro_name=u'BlueShoeLinux5-5') data_setup.create_product(product_name=u'the_product')
def setUp(self): data_setup.create_product(product_name=u'the_product') data_setup.create_group(group_name='somegroup') data_setup.create_distro_tree(distro_name=u'BlueShoeLinux5-5')
def setUp(self): data_setup.create_product(product_name=u'the_product') data_setup.create_group(group_name='somegroup') if not Distro.by_name(u'BlueShoeLinux5-5'): data_setup.create_distro_tree(distro_name=u'BlueShoeLinux5-5')