def test_launcher_exists_but_not_schema_in_none_unity(self, SettingsMock): """Launcher exists return True if file exists, even if Unity schema isn't installed""" os.environ["XDG_CURRENT_DESKTOP"] = "FOOenv" SettingsMock.list_schemas.return_value = ["foo", "bar", "baz"] self.write_desktop_file("foo.desktop") self.assertTrue(launcher_exists_and_is_pinned("foo.desktop"))
def test_launcher_doesnt_exists_but_pinned(self, SettingsMock): """Launcher doesn't exist if no file, even if pinned""" SettingsMock.list_schemas.return_value = ["foo", "bar", "com.canonical.Unity.Launcher", "baz"] SettingsMock.return_value.get_strv.return_value = ["application://bar.desktop", "application://foo.desktop", "unity://running-apps"] self.assertFalse(launcher_exists_and_is_pinned("foo.desktop"))
def test_launcher_isnt_pinned(self, SettingsMock): """Launcher doesn't exists and is pinned if the file exists but not in favorites list""" SettingsMock.list_schemas.return_value = ["foo", "bar", "com.canonical.Unity.Launcher", "baz"] SettingsMock.return_value.get_strv.return_value = ["application://bar.desktop", "unity://running-apps"] self.write_desktop_file("foo.desktop") self.assertFalse(launcher_exists_and_is_pinned("foo.desktop"))
def test_launcher_exists_but_isnt_pinned_in_none_unity(self, SettingsMock): """Launcher exists return True if file exists, not pinned but not in Unity""" os.environ["XDG_CURRENT_DESKTOP"] = "FOOenv" SettingsMock.list_schemas.return_value = ["foo", "bar", "com.canonical.Unity.Launcher", "baz"] SettingsMock.return_value.get_strv.return_value = ["application://bar.desktop", "unity://running-apps"] self.write_desktop_file("foo.desktop") self.assertTrue(launcher_exists_and_is_pinned("foo.desktop"))
def test_launcher_exists_but_not_schema_in_unity(self, SettingsMock): """Launcher exists return False if file exists, but no Unity schema installed""" SettingsMock.list_schemas.return_value = ["foo", "bar", "baz"] self.write_desktop_file("foo.desktop") self.assertFalse(launcher_exists_and_is_pinned("foo.desktop"))
def launcher_exists_and_is_pinned(self, launcher_path): """passthrough to in process method""" return launcher_exists_and_is_pinned(launcher_path)
def launcher_exists_and_is_pinned(self, desktop_filename): """passthrough to in process method""" return launcher_exists_and_is_pinned(desktop_filename)