Esempio n. 1
0
def test_inhibit_on_duplicate_repos_no_dups(monkeypatch):
    monkeypatch.setattr(reporting, 'create_report', create_report_mocked())
    monkeypatch.setattr(api, 'current_logger', logger_mocked())

    rhsm._inhibit_on_duplicate_repos([_gen_repofile("foo")])

    assert not api.current_logger.warnmsg
    assert reporting.create_report.called == 0
Esempio n. 2
0
def test_inhibit_on_duplicate_repos_no_dups(monkeypatch):
    monkeypatch.setattr(reporting, 'create_report', create_report_mocked())
    monkeypatch.setattr(api, 'current_logger', LoggerMocked())

    rhsm._inhibit_on_duplicate_repos(YUM_REPOINFO_TYPICAL)

    assert api.current_logger.warnmsg is None
    assert reporting.create_report.called == 0
Esempio n. 3
0
def test_inhibit_on_duplicate_repos(monkeypatch):
    monkeypatch.setattr(reporting, 'create_report', create_report_mocked())
    monkeypatch.setattr(api, 'current_logger', LoggerMocked())

    rhsm._inhibit_on_duplicate_repos(YUM_REPOINFO_DUPS + YUM_REPOINFO_TYPICAL)

    dups = ['rhel-7-server-eus-rpms', 'rhel-7-server-extras-rpms', 'rhel-7-server-eus-optional-rpms']
    assert ('The following repoids are defined multiple times:{0}{1}'
            .format(LIST_SEPARATOR, LIST_SEPARATOR.join(dups))) in api.current_logger.warnmsg
    assert reporting.create_report.called == 1
    assert 'inhibitor' in reporting.create_report.report_fields['flags']
    assert reporting.create_report.report_fields['title'] == 'A YUM/DNF repository defined multiple times'
    assert ('the following repositories are defined multiple times:{0}{1}'
            .format(LIST_SEPARATOR, LIST_SEPARATOR.join(dups))) in reporting.create_report.report_fields['summary']
Esempio n. 4
0
def test_inhibit_on_duplicate_repos(monkeypatch):
    monkeypatch.setattr(reporting, 'create_report', create_report_mocked())
    monkeypatch.setattr(api, 'current_logger', logger_mocked())
    repofiles = [
        _gen_repofile(
            "foo", [_gen_repo('repoX'), _gen_repo('repoY')]),
        _gen_repofile("bar", [_gen_repo('repoX')]),
    ]

    rhsm._inhibit_on_duplicate_repos(repofiles)

    dups = ['repoX']
    assert ('The following repoids are defined multiple times:{0}{1}'.format(
        LIST_SEPARATOR,
        LIST_SEPARATOR.join(dups))) in api.current_logger.warnmsg
    assert reporting.create_report.called == 1
    assert 'inhibitor' in reporting.create_report.report_fields['flags']
    assert reporting.create_report.report_fields[
        'title'] == 'A YUM/DNF repository defined multiple times'
    summary = (
        'The following repositories are defined multiple times:{0}{1}'.format(
            LIST_SEPARATOR, LIST_SEPARATOR.join(dups)))
    assert summary in reporting.create_report.report_fields['summary']