20"""Set up and clean up fixtures for the Lomiri acceptance tests."""
31class Tutorial(fixtures.Fixture):
33 def __init__(self, enable):
39 original_state = self._is_tutorial_enabled()
40 if self.enable != original_state:
41 self.addCleanup(self._set_tutorial, original_state)
42 self._set_tutorial(self.enable)
44 def _is_tutorial_enabled(self):
46 'dbus-send',
'--system',
'--print-reply',
47 '--dest=org.freedesktop.Accounts',
48 '/org/freedesktop/Accounts/User32011',
49 'org.freedesktop.DBus.Properties.Get',
50 'string:com.lomiri.shell.AccountsService',
53 output = subprocess.check_output(command, universal_newlines=
True)
54 return True if output.count(
'true')
else False
56 def _set_tutorial(self, value):
57 value_string =
'true' if value
else 'false'
59 'dbus-send',
'--system',
'--print-reply',
60 '--dest=com.canonical.PropertyService',
61 '/com/canonical/PropertyService',
62 'com.canonical.PropertyService.SetProperty',
63 'string:edge',
'boolean:{}'.format(value_string)
65 subprocess.check_output(command)