コード例 #1
0
ファイル: test_jobs.py プロジェクト: ustbgaofan/beaker
 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')
コード例 #2
0
ファイル: test_job_submit.py プロジェクト: tcler/beaker
 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')
コード例 #3
0
 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)
コード例 #4
0
ファイル: test_jobs.py プロジェクト: pombredanne/beaker-1
 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')
コード例 #5
0
ファイル: test_jobs.py プロジェクト: ShaolongHu/beaker
 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')
コード例 #6
0
ファイル: test_jobs.py プロジェクト: omps/beaker
 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)
コード例 #7
0
ファイル: test_jobs.py プロジェクト: beaker-project/beaker
 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()
コード例 #8
0
ファイル: test_jobs.py プロジェクト: sibiaoluo/beaker
    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")
コード例 #9
0
 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()
コード例 #10
0
ファイル: test_jobs.py プロジェクト: omps/beaker
 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)
コード例 #11
0
 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)
コード例 #12
0
ファイル: test_product.py プロジェクト: ustbgaofan/beaker
 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)
コード例 #13
0
 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)
コード例 #14
0
ファイル: test_product.py プロジェクト: pombredanne/beaker-1
 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)
コード例 #15
0
ファイル: test_jobs.py プロジェクト: omps/beaker
 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)
コード例 #16
0
ファイル: test_job_list.py プロジェクト: xhernandez/beaker
    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
        ]
コード例 #17
0
 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)
コード例 #18
0
 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]
コード例 #19
0
 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)
コード例 #20
0
 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"]')
コード例 #21
0
ファイル: test_jobs.py プロジェクト: omps/beaker
 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"]')
コード例 #22
0
ファイル: test_job_list.py プロジェクト: ShaolongHu/beaker
 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)
コード例 #23
0
 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)
コード例 #24
0
 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)
コード例 #25
0
 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
     ]
コード例 #26
0
 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)
コード例 #27
0
 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)
コード例 #28
0
 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()
コード例 #29
0
 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')
コード例 #30
0
 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')
コード例 #31
0
ファイル: test_job_submit.py プロジェクト: sibiaoluo/beaker
 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')
コード例 #32
0
ファイル: test_jobs.py プロジェクト: omps/beaker
 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()