Esempio n. 1
0
 def test_binary_create_repo_object(self, session):
     binary = Binary(
         'ceph-1.0.rpm',
         self.p,
         ref='firefly',
         distro='centos',
         distro_version='7',
         arch='x86_64',
     )
     session.commit()
     binary = Binary.get(1)
     assert binary.repo.ref == 'firefly'
     assert binary.repo.distro_version == '7'
Esempio n. 2
0
 def test_binary_create_repo_object(self, session):
     binary = Binary(
         'ceph-1.0.rpm',
         self.p,
         ref='firefly',
         distro='centos',
         distro_version='7',
         arch='x86_64',
         )
     session.commit()
     binary = Binary.get(1)
     assert binary.repo.ref == 'firefly'
     assert binary.repo.distro_version == '7'
Esempio n. 3
0
 def test_binary_uses_explicit_repo(self, session):
     repo = Repo(self.p, 'firefly', 'centos', '7')
     binary = Binary(
         'ceph-1.0.rpm',
         self.p,
         distro='centos',
         distro_version='7',
         arch='x86_64',
         repo=repo,
         )
     session.commit()
     binary = Binary.get(1)
     assert binary.repo.ref == 'firefly'
     assert binary.repo.distro_version == '7'
Esempio n. 4
0
 def test_binary_uses_explicit_repo(self, session):
     repo = Repo(self.p, 'firefly', 'centos', '7')
     binary = Binary(
         'ceph-1.0.rpm',
         self.p,
         distro='centos',
         distro_version='7',
         arch='x86_64',
         repo=repo,
     )
     session.commit()
     binary = Binary.get(1)
     assert binary.repo.ref == 'firefly'
     assert binary.repo.distro_version == '7'
Esempio n. 5
0
 def test_binary_reuse_repo_object(self, session):
     repo = Repo(self.p, 'hammer', 'centos', '7')
     session.commit()
     binary = Binary(
         'ceph-1.0.rpm',
         self.p,
         ref='hammer',
         distro='centos',
         distro_version='7',
         arch='x86_64',
         )
     session.commit()
     binary = Binary.get(1)
     assert binary.repo.ref == 'hammer'
     assert binary.repo.distro_version == '7'
Esempio n. 6
0
    def test_modified_is_older_than_created(self, session):
        binary = Binary(
            'ceph-1.0.rpm',
            self.p,
            distro='centos',
            distro_version='7',
            arch='x86_64',
            )
        session.commit()
        initial_created = binary.created.time()
        binary.ref = 'master'
        session.commit()
        binary = Binary.get(1)

        assert initial_created < binary.modified.time()
Esempio n. 7
0
 def test_binary_reuse_repo_object(self, session):
     Repo(self.p, 'hammer', 'centos', '7')
     session.commit()
     binary = Binary(
         'ceph-1.0.rpm',
         self.p,
         ref='hammer',
         distro='centos',
         distro_version='7',
         arch='x86_64',
     )
     session.commit()
     binary = Binary.get(1)
     assert binary.repo.ref == 'hammer'
     assert binary.repo.distro_version == '7'
Esempio n. 8
0
    def test_modified_is_older_than_created(self, session):
        binary = Binary(
            'ceph-1.0.rpm',
            self.p,
            distro='centos',
            distro_version='7',
            arch='x86_64',
        )
        session.commit()
        initial_created = binary.created.time()
        binary.ref = 'master'
        session.commit()
        binary = Binary.get(1)

        assert initial_created < binary.modified.time()
Esempio n. 9
0
    def test_new_binary_upload_creates_model_with_path_forced(self, session, tmpdir):
        pecan.conf.binary_root = str(tmpdir)

        session.app.post(
            '/binaries/ceph/giant/ceph/el6/x86_64/',
            upload_files=[('file', 'ceph-9.0.0-0.el6.x86_64.rpm', 'hello tharrrr')]
        )
        session.app.put(
            '/binaries/ceph/giant/ceph/el6/x86_64/ceph-9.0.0-0.el6.x86_64.rpm/',
            upload_files=[('file', 'ceph-9.0.0-0.el6.x86_64.rpm', 'hello tharrrr')]
        )
        session.app.put(
            '/binaries/ceph/giant/ceph/el6/x86_64/ceph-9.0.0-0.el6.x86_64.rpm/',
            upload_files=[('file', 'ceph-9.0.0-0.el6.x86_64.rpm', 'hello tharrrr')]
        )

        binary = Binary.get(1)
        assert binary.path.endswith('ceph/giant/ceph/el6/x86_64/ceph-9.0.0-0.el6.x86_64.rpm')
Esempio n. 10
0
    def test_new_binary_upload_creates_model_with_path_forced(
            self, session, tmpdir):
        pecan.conf.binary_root = str(tmpdir)

        session.app.post('/binaries/ceph/giant/head/ceph/el6/x86_64/',
                         upload_files=[('file', 'ceph-9.0.0-0.el6.x86_64.rpm',
                                        b_('hello tharrrr'))])
        session.app.put(
            '/binaries/ceph/giant/head/ceph/el6/x86_64/ceph-9.0.0-0.el6.x86_64.rpm/',
            upload_files=[('file', 'ceph-9.0.0-0.el6.x86_64.rpm',
                           b_('hello tharrrr'))])
        session.app.put(
            '/binaries/ceph/giant/head/ceph/el6/x86_64/ceph-9.0.0-0.el6.x86_64.rpm/',
            upload_files=[('file', 'ceph-9.0.0-0.el6.x86_64.rpm',
                           b_('hello tharrrr'))])

        binary = Binary.get(1)
        assert binary.path.endswith(
            'ceph/giant/head/ceph/el6/x86_64/ceph-9.0.0-0.el6.x86_64.rpm')