Esempio n. 1
0
    def set_up(self):
        super(TestDebianPoolInjector, self).set_up()

        blob_id = 'sha-1:b7d31cf9a160c3aadaf5f1cd86cdc8762b3d4b1b'
        self.bin = self.cache.load_package(blob_id, 'deb')
        self.bin_injector = DebianPoolInjector(self.cache, self.bin,
                                               'main', self.repo.repo_dir)

        blob_id = 'sha-1:9d26152e78ca33a3d435433c67644b52ae4c670c'
        self.src = self.cache.load_package(blob_id, 'dsc')
        self.src_injector = DebianPoolInjector(self.cache, self.src,
                                               'main', self.repo.repo_dir)
Esempio n. 2
0
class TestDebianPoolInjector(DebianPoolFixture):
    def set_up(self):
        super(TestDebianPoolInjector, self).set_up()

        blob_id = 'sha-1:b7d31cf9a160c3aadaf5f1cd86cdc8762b3d4b1b'
        self.bin = self.cache.load_package(blob_id, 'deb')
        self.bin_injector = DebianPoolInjector(self.cache, self.bin,
                                               'main', self.repo.repo_dir)

        blob_id = 'sha-1:9d26152e78ca33a3d435433c67644b52ae4c670c'
        self.src = self.cache.load_package(blob_id, 'dsc')
        self.src_injector = DebianPoolInjector(self.cache, self.src,
                                               'main', self.repo.repo_dir)

    def test_pool_location(self):
        location = self.bin_injector.get_pool_location()
        expected = pjoin(self.repo.repo_dir, 'pool', 'main', 'a',
                         'apache2', self.bin.filename)
        self.assert_equals_long(expected, location)

    def test_extra_pool_locations(self):
        self.assert_equal({},
                          self.bin_injector.get_extra_pool_locations())

        src_package_path = self.src_injector.get_pool_location()
        src_package_dir = pjoin(src_package_path, '..')
        extras = {}
        extras.update(dict([ (pjoin(src_package_dir, filename), blob_id)
                             for blob_id, dummy, filename
                             in self.src.pdk.extra_file ]))
        actual_extras = self.src_injector.get_extra_pool_locations()
        self.assert_equals_long(extras, actual_extras)

    def test_relative_pool_path(self):
        actual_path = "pool/main/a/apache2"
        self.assert_equals_long(self.bin_injector.get_relative_pool_path(),
                                actual_path)
        self.assert_equals_long(self.src_injector.get_relative_pool_path(),
                                actual_path)

    def test_get_links(self):
        package_location = self.src_injector.get_pool_location()
        package_dir = pjoin(self.src_injector.get_pool_location(), '..')
        files = [ t[0] for t in self.src.pdk.extra_file ]
        files.sort()
        expected = { package_location: self.src.blob_id,
                     pjoin(package_dir, 'apache2_2.0.53-5.diff.gz'):
                     'md5:0d060d66b3a1e6ec0b9c58e995f7b9f7',
                     pjoin(package_dir, 'apache2_2.0.53.orig.tar.gz'):
                     'md5:40507bf19919334f07355eda2df017e5' }
        actual = self.src_injector.get_links()
        self.assert_equals_long(expected, actual)