Debian Codegraph @

tests/probes/fwupdsecattr/org.freedesktop.fwupd.py

raw symbols SCIP
1 # This is a template for D-Bus mock
2 # see init_dbus_mock() from test_common.sh.
3 # The Exit() method is expected by
4 # clean_dbus_mock() from the same file.
5
6 __author__ = 'Evgenii Kolesnikov'
7 __copyright__ = '''
8 (c) 2023 Red Hat Inc.
9 '''
10
11 import dbus
12
13
14 BUS_NAME = 'org.freedesktop.fwupd'
15 MAIN_OBJ = '/'
16 MAIN_IFACE = 'org.freedesktop.fwupd'
17 SYSTEM_BUS = False
18
19
20 def load(mock, _parameters):
21 mock.AddMethods(MAIN_IFACE, [
22 ('GetHostSecurityAttrs', '', 'aa{sv}', 'ret = self.SecurityAattrs'),
23 ('Exit', '', '', 'sys.exit()'),
24 ])
25
26 mock.SecurityAattrs = [
27 {
28 'AppstreamId': 'org.fwupd.hsi.Kernel.Lockdown', 'HsiResult': dbus.UInt32(2)
29 },
30 {
31 'AppstreamId': 'org.fwupd.hsi.Kernel.InvalidStatus', 'HsiResult': dbus.UInt32(200)
32 }
33 ]