Example #1
0
    def test_skips_marking_needs_update(self, session, tmpdir, url):
        pecan.conf.binary_root = str(tmpdir)
        pecan.conf.repos = {
            'ceph-deploy': {
                'automatic': False,
            },
            '__force_dict__': True,
        }
        session.app.post(url,
                         upload_files=[('file',
                                        'ceph-deploy_9.0.0-0.el6.x86_64.rpm',
                                        b_('hello tharrrr'))])
        project = Project.filter_by(name='ceph-deploy').first()
        repo = Repo.filter_by(project=project).first()
        # newly created repos will default to ``needs_update`` as ``True``,
        # revert so we can test if disabling automatic repos works
        repo.needs_update = False
        session.commit()

        session.app.post(url,
                         upload_files=[('file',
                                        'ceph-deploy_10.0.0-0.el6.x86_64.rpm',
                                        b_('newer version'))])
        project = Project.filter_by(name='ceph-deploy').first()
        repo = Repo.filter_by(project=project).first()
        assert repo.needs_update is False
Example #2
0
 def test_marks_multiple_projects(self, session, tmpdir, url):
     pecan.conf.binary_root = str(tmpdir)
     pecan.conf.repos = {
         'ceph': {
             'all': {
                 'ceph-deploy': ['master']
             },
         },
         'rhcs': {
             'all': {
                 'ceph-deploy': ['master']
             },
         },
         '__force_dict__': True,
     }
     session.commit()
     session.app.post(url,
                      upload_files=[('file',
                                     'ceph-deploy_9.0.0-0.el6.x86_64.rpm',
                                     b_('hello tharrrr'))])
     ceph_project = Project.filter_by(name='ceph').first()
     rhcs_project = Project.filter_by(name='rhcs').first()
     assert Repo.filter_by(
         project=ceph_project).first().needs_update is True
     assert Repo.filter_by(
         project=rhcs_project).first().needs_update is True
Example #3
0
 def test_marks_multiple_projects(self, session, tmpdir):
     pecan.conf.binary_root = str(tmpdir)
     pecan.conf.repos = {
         'ceph': {
             'all': {'ceph-deploy': ['master']},
         },
         'rhcs': {
             'all': {'ceph-deploy': ['master']},
         },
         '__force_dict__': True,
     }
     session.commit()
     session.app.post(
         '/binaries/ceph-deploy/master/centos/6/x86_64/',
         upload_files=[('file', 'ceph-deploy_9.0.0-0.el6.x86_64.rpm', 'hello tharrrr')]
     )
     ceph_project = Project.filter_by(name='ceph').first()
     rhcs_project = Project.filter_by(name='rhcs').first()
     assert Repo.filter_by(project=ceph_project).first().needs_update is True
     assert Repo.filter_by(project=rhcs_project).first().needs_update is True
Example #4
0
 def test_marks_nonexsitent_related_project_type(self, session, tmpdir):
     pecan.conf.binary_root = str(tmpdir)
     pecan.conf.repos = {
         'ceph': {
             'all': {'ceph-deploy': ['master']}
         },
         '__force_dict__': True,
     }
     session.app.post(
         '/binaries/ceph-deploy/master/centos/6/x86_64/',
         upload_files=[('file', 'ceph-deploy_9.0.0-0.el6.x86_64.rpm', 'hello tharrrr')]
     )
     project = Project.filter_by(name='ceph').first()
     repo = Repo.filter_by(project=project).first()
     assert repo.type == 'rpm'
Example #5
0
 def test_marks_nonexsitent_related_project(self, session, tmpdir):
     pecan.conf.binary_root = str(tmpdir)
     pecan.conf.repos = {
         'ceph': {
             'all': {'ceph-deploy': ['master']}
         },
         '__force_dict__': True,
     }
     session.app.post(
         '/binaries/ceph-deploy/master/centos/6/x86_64/',
         upload_files=[('file', 'ceph-deploy_9.0.0-0.el6.x86_64.rpm', 'hello tharrrr')]
     )
     project = Project.filter_by(name='ceph').first()
     # should've create the ceph project because it didn't exist
     assert project is not None
     repo = Repo.filter_by(project=project).first()
     assert repo.needs_update is True
Example #6
0
 def test_marks_nonexsitent_related_project_type(self, session, tmpdir,
                                                 url):
     pecan.conf.binary_root = str(tmpdir)
     pecan.conf.repos = {
         'ceph': {
             'all': {
                 'ceph-deploy': ['master']
             }
         },
         '__force_dict__': True,
     }
     session.app.post(url,
                      upload_files=[('file',
                                     'ceph-deploy_9.0.0-0.el6.x86_64.rpm',
                                     b_('hello tharrrr'))])
     project = Project.filter_by(name='ceph').first()
     repo = Repo.filter_by(project=project).first()
     assert repo.type == 'rpm'
Example #7
0
 def test_marks_nonexsitent_related_project(self, session, tmpdir, url):
     pecan.conf.binary_root = str(tmpdir)
     pecan.conf.repos = {
         'ceph': {
             'all': {
                 'ceph-deploy': ['master']
             }
         },
         '__force_dict__': True,
     }
     session.app.post(url,
                      upload_files=[('file',
                                     'ceph-deploy_9.0.0-0.el6.x86_64.rpm',
                                     b_('hello tharrrr'))])
     project = Project.filter_by(name='ceph').first()
     # should've create the ceph project because it didn't exist
     assert project is not None
     repo = Repo.filter_by(project=project).first()
     assert repo.needs_update is True
Example #8
0
 def test_marks_existing_related_project(self, session, tmpdir, url):
     pecan.conf.binary_root = str(tmpdir)
     pecan.conf.repos = {
         'ceph': {
             'all': {
                 'ceph-deploy': ['master']
             }
         },
         '__force_dict__': True,
     }
     Project(name='ceph')
     session.commit()
     session.app.post(url,
                      upload_files=[
                          ('file', 'ceph-deploy_9.0.0-0.el6.x86_64.rpm',
                           'hello tharrrr')
                      ])
     project = Project.filter_by(name='ceph').first()
     assert project is not None
     repo = Repo.filter_by(project=project).first()
     assert repo.needs_update is True