def test_installed_nodefconf(monkeypatch): monkeypatch.setattr(reporting, 'report_generic', report_generic_mocked()) monkeypatch.setattr(library, 'is_config_default', lambda: False) library.check_chrony(True) assert reporting.report_generic.called == 1 assert reporting.report_generic.report_fields['title'] == \ 'chrony using non-default configuration'
def test_installed_defconf(monkeypatch): monkeypatch.setattr(reporting, 'create_report', create_report_mocked()) monkeypatch.setattr(library, 'is_config_default', lambda: True) library.check_chrony(True) assert reporting.create_report.called == 1 assert reporting.create_report.report_fields[ 'title'] == 'chrony using default configuration'
def test_uninstalled(monkeypatch): for config_default in (False, True): monkeypatch.setattr(reporting, 'create_report', create_report_mocked()) monkeypatch.setattr(library, 'is_config_default', lambda: config_default) library.check_chrony(False) assert reporting.create_report.called == 0
def process(self): installed_packages = set() signed_rpms = self.consume(InstalledRedHatSignedRPM) for rpm_pkgs in signed_rpms: for pkg in rpm_pkgs.items: installed_packages.add(pkg.name) check_chrony('chrony' in installed_packages)
def process(self): check_chrony(has_package(InstalledRedHatSignedRPM, 'chrony'))