Exemple #1
0
def test_only_kde(monkeypatch):
    """
    Scenario: There is only KDE installed.
    Expected behavior: Report is generated with HIGH severity and inhibitor tag.
    """

    monkeypatch.setattr(library, "is_executable", is_executable_only_kde)
    monkeypatch.setattr(reporting, "create_report", create_report_mocked())

    library.check_kde_gnome()

    assert reporting.create_report.called == 1
    assert "inhibitor" in reporting.create_report.report_fields["flags"]
Exemple #2
0
def test_only_gnome_without_apps(monkeypatch):
    """
    Scenario: KDE and KDE apps are NOT installed
    Expected behavior: No report
    """

    monkeypatch.setattr(library, "is_executable", is_executable_only_gnome)
    monkeypatch.setattr(library, "is_installed", lambda x: False)
    monkeypatch.setattr(reporting, "create_report", create_report_mocked())

    library.check_kde_gnome()

    assert reporting.create_report.called == 0
Exemple #3
0
def test_no_desktop(monkeypatch):
    """
    Scenario: There is no desktop.
    Expected behavior: No report
    """

    #  Desktop presence is found by trying to execute gnome-session or startkde
    monkeypatch.setattr(library, "is_executable", lambda x: False)
    monkeypatch.setattr(reporting, "create_report", create_report_mocked())

    library.check_kde_gnome()

    assert reporting.create_report.called == 0
Exemple #4
0
def test_only_gnome_without_active_apps(monkeypatch):
    """
    Scenatio: no KDE desktop is installed, but there are some KDE apps, which are not active
    Expected behavior: No report (unused app is not considered to be important)
    """

    monkeypatch.setattr(library, "is_executable", is_executable_only_gnome)
    monkeypatch.setattr(library, "is_installed", lambda x: True)
    monkeypatch.setattr(library, "check_app_in_use", lambda x: False)
    monkeypatch.setattr(reporting, "create_report", create_report_mocked())

    library.check_kde_gnome()

    assert reporting.create_report.called == 0
Exemple #5
0
def test_both_gnome_main_without_active_apps(monkeypatch):
    """
    Scenario: There are both KDE and GNOME installed, GNOME is the main desktop
    and there are no KDE apps
    Expected behavior: No report is generated.
    """

    monkeypatch.setattr(library, "is_executable", lambda x: True)
    monkeypatch.setattr(library, "is_installed", lambda x: False)
    monkeypatch.setattr(library, "get_xsession", get_xsession_gnome)
    monkeypatch.setattr(reporting, "create_report", create_report_mocked())

    library.check_kde_gnome()

    assert reporting.create_report.called == 0
Exemple #6
0
def test_only_gnome_with_active_apps(monkeypatch):
    """
    Scenatio: no KDE desktop is installed, but there are some KDE apps, which are actively used
    Expected behavior: Report is made (severity = MEDIUM)
    """

    monkeypatch.setattr(library, "is_executable", is_executable_only_gnome)
    monkeypatch.setattr(library, "is_installed", lambda x: True)
    monkeypatch.setattr(library, "check_app_in_use", check_app_in_use_mocked)
    monkeypatch.setattr(reporting, "create_report", create_report_mocked())

    library.check_kde_gnome()

    assert reporting.create_report.called == 1
    title_KDE_apps = "Upgrade can be performed, but KDE apps will be uninstalled."
    assert reporting.create_report.report_fields["title"] == title_KDE_apps
Exemple #7
0
def test_both_kde_main_with_active_apps(monkeypatch):
    """
    Scenario: There are both KDE and GNOME installed, KDE is the main desktop
    and there are some KDE apps
    Expected behavior: Two reports are generated: one about KDE and one about KDE apps.
    """

    monkeypatch.setattr(library, "is_executable", lambda x: True)
    monkeypatch.setattr(library, "is_installed", lambda x: True)
    monkeypatch.setattr(library, "get_xsession", get_xsession_kde)
    monkeypatch.setattr(library, "check_app_in_use", check_app_in_use_mocked)
    monkeypatch.setattr(reporting, "create_report", create_report_mocked())

    library.check_kde_gnome()

    assert reporting.create_report.called == 2
Exemple #8
0
def test_both_kde_main_without_active_apps(monkeypatch):
    """
    Scenario: There are both KDE and GNOME installed, KDE is the main desktop
    and there are no KDE apps
    Expected behavior: There is a report generated.
    """

    monkeypatch.setattr(library, "is_executable", lambda x: True)
    monkeypatch.setattr(library, "is_installed", lambda x: False)
    monkeypatch.setattr(library, "get_xsession", get_xsession_kde)
    monkeypatch.setattr(reporting, "create_report", create_report_mocked())

    library.check_kde_gnome()

    assert reporting.create_report.called == 1
    title_KDE = "Upgrade can be performed, but KDE will be uninstalled."
    assert reporting.create_report.report_fields["title"] == title_KDE
Exemple #9
0
 def process(self):
     check_kde_gnome()