From afc5aab0232b262f38e21bbff8bc916444bb9975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 11 Jun 2024 17:19:14 +0200 Subject: [PATCH] tests: handle org.mozilla.thunderbird name too Thinderbird desktop file got renamed in F40. QubesOS/qubes-issues#8915 (cherry picked from commit b7f065315ef4da87bcbbc4b4a7e15c5f90075f91) --- qubes/tests/integ/dispvm.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/qubes/tests/integ/dispvm.py b/qubes/tests/integ/dispvm.py index c347251f9..196f04cc2 100644 --- a/qubes/tests/integ/dispvm.py +++ b/qubes/tests/integ/dispvm.py @@ -18,7 +18,9 @@ # License along with this library; if not, see . # import contextlib +import grp import os +import pwd import subprocess import tempfile import time @@ -393,12 +395,26 @@ def _get_open_script(self, application): "app = tree.root.application('org.gnome.Nautilus')\n" "app.child(os.path.basename(sys.argv[1])).doubleClick()\n" ).encode() - if application in ('mozilla-thunderbird', 'thunderbird'): + if application in ('mozilla-thunderbird', 'thunderbird', 'org.mozilla.thunderbird'): with open('/usr/share/qubes/tests-data/' 'dispvm-open-thunderbird-attachment', 'rb') as f: return f.read() assert False + def _get_apps_list(self, template): + try: + # get first user in the qubes group + qubes_grp = grp.getgrnam("qubes") + qubes_user = pwd.getpwnam(qubes_grp.gr_mem[0]) + except KeyError: + self.skipTest('Cannot find a user in the qubes group') + + desktop_list = os.listdir(os.path.join( + qubes_user.pw_dir, + f'.local/share/qubes-appmenus/{template}/apps.templates')) + return [l[:-len('.desktop')] for l in desktop_list + if l.endswith('.desktop')] + @unittest.skipUnless(spawn.find_executable('xdotool'), "xdotool not installed") def test_100_open_in_dispvm(self): @@ -412,6 +428,9 @@ def test_100_open_in_dispvm(self): app_id = 'mozilla-thunderbird' if 'debian' in self.template or 'whonix' in self.template: app_id = 'thunderbird' + # F40+ has org.mozilla.thunderbird + if 'org.mozilla.thunderbird' in self._get_apps_list(self.template): + app_id = 'org.mozilla.thunderbird' self.testvm1.features['service.app-dispvm.' + app_id] = '1' self.loop.run_until_complete(self.testvm1.start())