Beispiel #1
0
    def setUp(self):
        super(TestIntegraton, self).setUp()
        dpkg_status_file = FakePackageFile(type='dpkg')
        debian_stable_package_file = FakePackageFile(archive='stable')
        debian_proposed_updates_package_file = FakePackageFile(
            archive='stable-proposed-updates')
        debian_security_package_file = FakePackageFile(
            archive='stable-security')
        local_package_file = FakePackageFile(origin='SnakeOil, Inc.',
                                             archive='etch')

        libc6_version = FakeVersion('2.6.1-2etch1')
        libc6_version.append_package_file(debian_stable_package_file)
        libc6_version.append_package_file(debian_security_package_file)
        libc6_updates_version = FakeVersion('2.6.1-2etch2')
        libc6_updates_version.append_package_file(
            debian_proposed_updates_package_file)
        libc6_updates_version.append_package_file(dpkg_status_file)
        libc6 = FakePackage(name='libc6')
        libc6.append_version(libc6_updates_version, True)
        libc6.append_version(libc6_version)

        libspf_version = FakeVersion('0.1-1')
        libspf_version.append_package_file(debian_stable_package_file)
        libspf_updates_version = FakeVersion('0.1-2')
        libspf_updates_version.append_package_file(
            debian_proposed_updates_package_file)
        libspf_local_version = FakeVersion('0.1-1~sl1')
        libspf_local_version.append_package_file(dpkg_status_file)
        libspf_local_version.append_package_file(local_package_file)
        libspf = FakePackage(name='libspf')
        libspf.append_version(libspf_version)
        libspf.append_version(libspf_local_version, True)
        libspf.append_version(libspf_updates_version)

        libfoobar_version = FakeVersion('0.5-5')
        libfoobar_version.append_package_file(debian_stable_package_file)
        libfoobar_local_version = FakeVersion('0.5-5~sl1')
        libfoobar_local_version.append_package_file(dpkg_status_file)
        libfoobar_local_version.append_package_file(local_package_file)
        libfoobar = FakePackage(name='libfoobar')
        libfoobar.append_version(libfoobar_version)
        libfoobar.append_version(libfoobar_local_version, True)

        git_version = FakeVersion('1:1.5.2.5-2build1')
        git_version.append_package_file(debian_stable_package_file)
        git_backport_version = FakeVersion('1:1.5.6.3-1.1ubuntu2~mowsiany.1')
        git_backport_version.append_package_file(dpkg_status_file)
        git_backport_version.append_package_file(local_package_file)
        git = FakePackage(name='git-core')
        git.append_version(git_version)
        git.append_version(git_backport_version, True)

        self.apt_cache = self.struct()
        self.apt_cache.packages = [git, libc6, libspf, libfoobar]

        self.apt_depcache = self.struct()
        version_table = {
            'libc6': libc6_updates_version,
            'libspf': libspf_local_version,
            'libfoobar': libfoobar_local_version,
            'git-core': git_backport_version
        }
        self.apt_depcache.get_candidate_ver = lambda o: version_table[o.name]

        self.reporter = self.mox.CreateMock(Reporter)
        self.mock_progress = self.struct()

        self.apt_pkg = self._create_mock_apt_pkg_module()
        test_helper.copy_state_constants(self.apt_pkg, apt_pkg)
        self.apt_pkg.Cache(self.mock_progress).AndReturn(self.apt_cache)

        self.facter = self.mox.CreateMock(Facter)
        self.facter.distributors_id = 'Debian'
 def set_up_apt_pkg(self):
     self.fake_apt_pkg_module = self._create_mock_apt_pkg_module()
     test_helper.copy_state_constants(self.fake_apt_pkg_module, apt_pkg)
	def setUp(self):
		super(TestIntegraton, self).setUp()
		dpkg_status_file = FakePackageFile(type = 'dpkg')
		debian_stable_package_file = FakePackageFile(archive = 'stable')
		debian_proposed_updates_package_file = FakePackageFile(archive = 'stable-proposed-updates')
		debian_security_package_file = FakePackageFile(archive = 'stable-security')
		local_package_file = FakePackageFile(origin = 'SnakeOil, Inc.', archive = 'etch')

		libc6_version = FakeVersion('2.6.1-2etch1')
		libc6_version.append_package_file(debian_stable_package_file)
		libc6_version.append_package_file(debian_security_package_file)
		libc6_updates_version = FakeVersion('2.6.1-2etch2')
		libc6_updates_version.append_package_file(debian_proposed_updates_package_file)
		libc6_updates_version.append_package_file(dpkg_status_file)
		libc6 = FakePackage(name = 'libc6')
		libc6.append_version(libc6_updates_version, True)
		libc6.append_version(libc6_version)

		libspf_version = FakeVersion('0.1-1')
		libspf_version.append_package_file(debian_stable_package_file)
		libspf_updates_version = FakeVersion('0.1-2')
		libspf_updates_version.append_package_file(debian_proposed_updates_package_file)
		libspf_local_version = FakeVersion('0.1-1~sl1')
		libspf_local_version.append_package_file(dpkg_status_file)
		libspf_local_version.append_package_file(local_package_file)
		libspf = FakePackage(name = 'libspf')
		libspf.append_version(libspf_version)
		libspf.append_version(libspf_local_version, True)
		libspf.append_version(libspf_updates_version)

		libfoobar_version = FakeVersion('0.5-5')
		libfoobar_version.append_package_file(debian_stable_package_file)
		libfoobar_local_version = FakeVersion('0.5-5~sl1')
		libfoobar_local_version.append_package_file(dpkg_status_file)
		libfoobar_local_version.append_package_file(local_package_file)
		libfoobar = FakePackage(name = 'libfoobar')
		libfoobar.append_version(libfoobar_version)
		libfoobar.append_version(libfoobar_local_version, True)

		git_version = FakeVersion('1:1.5.2.5-2build1')
		git_version.append_package_file(debian_stable_package_file)
		git_backport_version = FakeVersion('1:1.5.6.3-1.1ubuntu2~mowsiany.1')
		git_backport_version.append_package_file(dpkg_status_file)
		git_backport_version.append_package_file(local_package_file)
		git = FakePackage(name = 'git-core')
		git.append_version(git_version)
		git.append_version(git_backport_version, True)

		self.apt_cache = self.struct()
		self.apt_cache.packages = [git, libc6, libspf, libfoobar]

		self.apt_depcache = self.struct()
		version_table = {
			'libc6': libc6_updates_version,
			'libspf': libspf_local_version,
			'libfoobar': libfoobar_local_version,
			'git-core': git_backport_version}
		self.apt_depcache.get_candidate_ver = lambda o: version_table[o.name]

		self.reporter = self.mox.CreateMock(Reporter)
		self.mock_progress = self.struct()

		self.apt_pkg = self._create_mock_apt_pkg_module()
		test_helper.copy_state_constants(self.apt_pkg, apt_pkg)
		self.apt_pkg.Cache(self.mock_progress).AndReturn(self.apt_cache)

		self.facter = self.mox.CreateMock(Facter)
		self.facter.distributors_id = 'Debian'
	def set_up_apt_pkg(self):
		self.fake_apt_pkg_module = self._create_mock_apt_pkg_module()
		test_helper.copy_state_constants(self.fake_apt_pkg_module, apt_pkg)