Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion qubes/tests/integ/dispvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
# License along with this library; if not, see <https://www.gnu.org/licenses/>.
#
import contextlib
import grp
import os
import pwd
import subprocess
import tempfile
import time
Expand Down Expand Up @@ -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):
Expand All @@ -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())
Expand Down