def test_verbose(self): # lib6 - never self.reporter.report( mox.Func(lambda o: o.package_name == 'libspf')).InAnyOrder() self.reporter.report( mox.Func(lambda o: o.package_name == 'libfoobar')).InAnyOrder() self.reporter.report( mox.Func(lambda o: o.package_name == 'git-core')).InAnyOrder() self.mox.ReplayAll() self.finishSetUp() checker = Checker(self.facter, True) policy = VerbosePolicy() self.cache_adapter.run(checker, policy, self.package_adapter_factory)
def run(verbose): facter = Facter() reporter = Reporter() apt_pkg_adapter = AptPkgAdapter(apt_pkg) apt_pkg_adapter.init() cache_adapter = apt_pkg_adapter.get_cache_adapter(CacheAdapterFactory(), reporter, NullProgress()) apt_depcache_adapter = apt_pkg_adapter.get_depcache_adapter( DepCacheAdapterFactory()) package_adapter_factory = PackageAdapterFactory(apt_depcache_adapter) checker = Checker(facter, verbose) config = Config() config_finder = ConfigFinder('/etc/apt/forktracer.conf', '/etc/apt/forktracer.d') config_parser = ConfigParser() for path, file in config_finder: config_parser.load(file, config) if verbose: policy = VerbosePolicy() else: policy = Policy(apt_pkg_adapter, facter, config) cache_adapter.run(checker, policy, package_adapter_factory)
def setUp(self): self.policy = VerbosePolicy()
class TestVerbosePolicy(unittest.TestCase): def setUp(self): self.policy = VerbosePolicy() def testTrue(self): self.assert_(self.policy.should_report(None))