def test_pes_data_not_found(monkeypatch): def file_not_exists(_filepath): return False monkeypatch.setattr('os.path.isfile', file_not_exists) monkeypatch.setattr(reporting, 'report_generic', report_generic_mocked()) with pytest.raises(StopActorExecution): get_events('/etc/leapp/pes-data.json') assert reporting.report_generic.called == 1 assert 'inhibitor' in reporting.report_generic.report_fields['flags']
def test_get_events(monkeypatch): monkeypatch.setattr(reporting, 'create_report', create_report_mocked()) with pytest.raises(StopActorExecution): get_events('files/tests/sample02.json') assert reporting.create_report.called == 1 assert 'inhibitor' in reporting.create_report.report_fields['flags'] reporting.create_report.called = 0 reporting.create_report.model_instances = [] with pytest.raises(StopActorExecution): get_events('files/tests/sample03.json') assert reporting.create_report.called == 1 assert 'inhibitor' in reporting.create_report.report_fields['flags']