python-dbusmock 0.32.1__tar.gz → 0.32.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/PKG-INFO +1 -1
- python-dbusmock-0.32.2/dbusmock/_version.py +1 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/mockobject.py +6 -6
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/bluez5-obex.py +13 -13
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/bluez5.py +65 -70
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/modemmanager.py +1 -1
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/networkmanager.py +3 -5
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/ofono.py +16 -16
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/polkitd.py +1 -1
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/upower.py +32 -32
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/packit.yaml +1 -1
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/pyproject.toml +1 -2
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/python_dbusmock.egg-info/PKG-INFO +1 -1
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/main.fmf +3 -3
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_api.py +10 -10
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_bluez5.py +74 -8
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_code.py +1 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_iio_sensors_proxy.py +0 -2
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_logind.py +1 -1
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_modemmanager.py +0 -2
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_networkmanager.py +13 -2
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_upower.py +1 -1
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_urfkill.py +5 -5
- python-dbusmock-0.32.1/dbusmock/_version.py +0 -2
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/.fmf/version +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/.github/release.eloquent.yml +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/.github/workflows/pages.yml +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/.github/workflows/release.yml +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/.github/workflows/tests.yml +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/.gitignore +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/.pre-commit-config.yaml +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/COPYING +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/NEWS +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/README.md +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/__init__.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/__main__.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/pytest_fixtures.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/SKELETON +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/__init__.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/gnome_screensaver.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/iio-sensors-proxy.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/logind.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/low_memory_monitor.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/notification_daemon.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/power_profiles_daemon.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/systemd.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/timedated.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/upower_power_profiles_daemon.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/urfkill.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/testcase.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/doc/conf.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/doc/index.rst +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/packaging/python-dbusmock.spec +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/plans/all.fmf +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/python_dbusmock.egg-info/SOURCES.txt +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/python_dbusmock.egg-info/dependency_links.txt +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/python_dbusmock.egg-info/requires.txt +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/python_dbusmock.egg-info/top_level.txt +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/setup.cfg +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/setup.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/__init__.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/conftest.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/run +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/run-centos +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/run-debian +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/run-fedora +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/run-ubuntu +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_api_pytest.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_cli.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_gnome_screensaver.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_low_memory_monitor.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_notification_daemon.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_ofono.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_polkitd.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_power_profiles_daemon.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_systemd.py +0 -0
- {python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/tests/test_timedated.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.32.2"
|
|
@@ -23,7 +23,7 @@ import time
|
|
|
23
23
|
import types
|
|
24
24
|
from pathlib import Path
|
|
25
25
|
from typing import Any, Dict, KeysView, List, Optional, Sequence, Tuple
|
|
26
|
-
from xml.etree import ElementTree
|
|
26
|
+
from xml.etree import ElementTree as ET
|
|
27
27
|
|
|
28
28
|
import dbus
|
|
29
29
|
import dbus.service
|
|
@@ -345,7 +345,7 @@ class DBusMockObject(dbus.service.Object): # pylint: disable=too-many-instance-
|
|
|
345
345
|
dbus_proxy.AddObject('/com/example/Foo/Manager',
|
|
346
346
|
'com.example.Foo.Control',
|
|
347
347
|
{
|
|
348
|
-
'state': dbus.String('online'
|
|
348
|
+
'state': dbus.String('online'),
|
|
349
349
|
},
|
|
350
350
|
[
|
|
351
351
|
('Start', '', '', ''),
|
|
@@ -789,7 +789,7 @@ class DBusMockObject(dbus.service.Object): # pylint: disable=too-many-instance-
|
|
|
789
789
|
|
|
790
790
|
xml = dbus.service.Object.Introspect(self, object_path, connection)
|
|
791
791
|
|
|
792
|
-
tree =
|
|
792
|
+
tree = ET.fromstring(xml)
|
|
793
793
|
|
|
794
794
|
for name, name_props in self.props.items():
|
|
795
795
|
# We might have properties for new interfaces we don't know about
|
|
@@ -797,14 +797,14 @@ class DBusMockObject(dbus.service.Object): # pylint: disable=too-many-instance-
|
|
|
797
797
|
# interface to append to, and create one if we can't.
|
|
798
798
|
interface = tree.find(f".//interface[@name='{name}']")
|
|
799
799
|
if interface is None:
|
|
800
|
-
interface =
|
|
800
|
+
interface = ET.Element("interface", {"name": name})
|
|
801
801
|
tree.append(interface)
|
|
802
802
|
|
|
803
803
|
for prop, val in name_props.items():
|
|
804
804
|
if val is None:
|
|
805
805
|
# can't guess type from None, skip
|
|
806
806
|
continue
|
|
807
|
-
elem =
|
|
807
|
+
elem = ET.Element(
|
|
808
808
|
"property",
|
|
809
809
|
{
|
|
810
810
|
"name": prop,
|
|
@@ -816,7 +816,7 @@ class DBusMockObject(dbus.service.Object): # pylint: disable=too-many-instance-
|
|
|
816
816
|
|
|
817
817
|
interface.append(elem)
|
|
818
818
|
|
|
819
|
-
xml =
|
|
819
|
+
xml = ET.tostring(tree, encoding="utf8", method="xml").decode("utf8")
|
|
820
820
|
|
|
821
821
|
# restore original class table
|
|
822
822
|
self._dbus_class_table[cls] = orig_interfaces
|
|
@@ -89,11 +89,11 @@ def CreateSession(self, destination, args):
|
|
|
89
89
|
|
|
90
90
|
path = client_path + "/session" + str(session_id)
|
|
91
91
|
properties = {
|
|
92
|
-
"Source": dbus.String("FIXME"
|
|
93
|
-
"Destination": dbus.String(destination
|
|
94
|
-
"Channel": dbus.Byte(0
|
|
95
|
-
"Target": dbus.String("FIXME"
|
|
96
|
-
"Root": dbus.String("FIXME"
|
|
92
|
+
"Source": dbus.String("FIXME"),
|
|
93
|
+
"Destination": dbus.String(destination),
|
|
94
|
+
"Channel": dbus.Byte(0),
|
|
95
|
+
"Target": dbus.String("FIXME"),
|
|
96
|
+
"Root": dbus.String("FIXME"),
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
self.AddObject(
|
|
@@ -213,11 +213,11 @@ def PullAll(self, target_file, filters):
|
|
|
213
213
|
filename = Path(temp_file.name).resolve()
|
|
214
214
|
|
|
215
215
|
props = {
|
|
216
|
-
"Status": dbus.String("queued"
|
|
217
|
-
"Session": dbus.ObjectPath(session_path
|
|
218
|
-
"Name": dbus.String(target_file
|
|
219
|
-
"Filename": dbus.String(filename
|
|
220
|
-
"Transferred": dbus.UInt64(0
|
|
216
|
+
"Status": dbus.String("queued"),
|
|
217
|
+
"Session": dbus.ObjectPath(session_path),
|
|
218
|
+
"Name": dbus.String(target_file),
|
|
219
|
+
"Filename": dbus.String(filename),
|
|
220
|
+
"Transferred": dbus.UInt64(0),
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
self.AddObject(
|
|
@@ -299,7 +299,7 @@ def UpdateStatus(self, is_complete):
|
|
|
299
299
|
transferred = Path(self.props[TRANSFER_IFACE]["Filename"]).stat().st_size
|
|
300
300
|
|
|
301
301
|
self.props[TRANSFER_IFACE]["Status"] = status
|
|
302
|
-
self.props[TRANSFER_IFACE]["Transferred"] = dbus.UInt64(transferred
|
|
302
|
+
self.props[TRANSFER_IFACE]["Transferred"] = dbus.UInt64(transferred)
|
|
303
303
|
|
|
304
304
|
self.EmitSignal(
|
|
305
305
|
dbus.PROPERTIES_IFACE,
|
|
@@ -308,8 +308,8 @@ def UpdateStatus(self, is_complete):
|
|
|
308
308
|
[
|
|
309
309
|
TRANSFER_IFACE,
|
|
310
310
|
{
|
|
311
|
-
"Status": dbus.String(status
|
|
312
|
-
"Transferred": dbus.UInt64(transferred
|
|
311
|
+
"Status": dbus.String(status),
|
|
312
|
+
"Transferred": dbus.UInt64(transferred),
|
|
313
313
|
},
|
|
314
314
|
[],
|
|
315
315
|
],
|
|
@@ -155,8 +155,8 @@ def StartDiscovery(adapter):
|
|
|
155
155
|
[
|
|
156
156
|
ADAPTER_IFACE,
|
|
157
157
|
{
|
|
158
|
-
"Discoverable": dbus.Boolean(adapter.props[ADAPTER_IFACE]["Discoverable"]
|
|
159
|
-
"Discovering": dbus.Boolean(adapter.props[ADAPTER_IFACE]["Discovering"]
|
|
158
|
+
"Discoverable": dbus.Boolean(adapter.props[ADAPTER_IFACE]["Discoverable"]),
|
|
159
|
+
"Discovering": dbus.Boolean(adapter.props[ADAPTER_IFACE]["Discovering"]),
|
|
160
160
|
},
|
|
161
161
|
[],
|
|
162
162
|
],
|
|
@@ -177,8 +177,8 @@ def StopDiscovery(adapter):
|
|
|
177
177
|
[
|
|
178
178
|
ADAPTER_IFACE,
|
|
179
179
|
{
|
|
180
|
-
"Discoverable": dbus.Boolean(adapter.props[ADAPTER_IFACE]["Discoverable"]
|
|
181
|
-
"Discovering": dbus.Boolean(adapter.props[ADAPTER_IFACE]["Discovering"]
|
|
180
|
+
"Discoverable": dbus.Boolean(adapter.props[ADAPTER_IFACE]["Discoverable"]),
|
|
181
|
+
"Discovering": dbus.Boolean(adapter.props[ADAPTER_IFACE]["Discovering"]),
|
|
182
182
|
},
|
|
183
183
|
[],
|
|
184
184
|
],
|
|
@@ -221,24 +221,23 @@ def AddAdapter(self, device_name, system_name):
|
|
|
221
221
|
# Audio/Video Remote Control Profile (target)
|
|
222
222
|
"0000110c-0000-1000-8000-00805f9b34fb",
|
|
223
223
|
],
|
|
224
|
-
variant_level=1,
|
|
225
224
|
),
|
|
226
|
-
"Discoverable": dbus.Boolean(False
|
|
227
|
-
"Discovering": dbus.Boolean(False
|
|
228
|
-
"Pairable": dbus.Boolean(True
|
|
229
|
-
"Powered": dbus.Boolean(True
|
|
230
|
-
"Address": dbus.String(address
|
|
231
|
-
"AddressType": dbus.String("public"
|
|
232
|
-
"Alias": dbus.String(system_name
|
|
233
|
-
"Modalias": dbus.String("usb:v1D6Bp0245d050A"
|
|
234
|
-
"Name": dbus.String(system_name
|
|
225
|
+
"Discoverable": dbus.Boolean(False),
|
|
226
|
+
"Discovering": dbus.Boolean(False),
|
|
227
|
+
"Pairable": dbus.Boolean(True),
|
|
228
|
+
"Powered": dbus.Boolean(True),
|
|
229
|
+
"Address": dbus.String(address),
|
|
230
|
+
"AddressType": dbus.String("public"),
|
|
231
|
+
"Alias": dbus.String(system_name),
|
|
232
|
+
"Modalias": dbus.String("usb:v1D6Bp0245d050A"),
|
|
233
|
+
"Name": dbus.String(system_name),
|
|
235
234
|
# Reference:
|
|
236
235
|
# http://bluetooth-pentest.narod.ru/software/
|
|
237
236
|
# bluetooth_class_of_device-service_generator.html
|
|
238
|
-
"Class": dbus.UInt32(268
|
|
239
|
-
"DiscoverableTimeout": dbus.UInt32(180
|
|
240
|
-
"PairableTimeout": dbus.UInt32(0
|
|
241
|
-
"Roles": dbus.Array(["central", "peripheral"]
|
|
237
|
+
"Class": dbus.UInt32(268), # Computer, Laptop
|
|
238
|
+
"DiscoverableTimeout": dbus.UInt32(180),
|
|
239
|
+
"PairableTimeout": dbus.UInt32(0),
|
|
240
|
+
"Roles": dbus.Array(["central", "peripheral"]),
|
|
242
241
|
}
|
|
243
242
|
|
|
244
243
|
self.AddObject(
|
|
@@ -277,10 +276,10 @@ def AddAdapter(self, device_name, system_name):
|
|
|
277
276
|
if bluez.enable_advertise_api:
|
|
278
277
|
# Example values below from an Intel AX200 adapter
|
|
279
278
|
advertising_manager_properties = {
|
|
280
|
-
"ActiveInstances": dbus.Byte(0
|
|
281
|
-
"SupportedInstances": dbus.Byte(MAX_ADVERTISEMENT_INSTANCES
|
|
282
|
-
"SupportedIncludes": dbus.Array(["tx-power", "appearance", "local-name", "rssi"]
|
|
283
|
-
"SupportedSecondaryChannels": dbus.Array(["1M", "2M", "Coded"]
|
|
279
|
+
"ActiveInstances": dbus.Byte(0),
|
|
280
|
+
"SupportedInstances": dbus.Byte(MAX_ADVERTISEMENT_INSTANCES),
|
|
281
|
+
"SupportedIncludes": dbus.Array(["tx-power", "appearance", "local-name", "rssi"]),
|
|
282
|
+
"SupportedSecondaryChannels": dbus.Array(["1M", "2M", "Coded"]),
|
|
284
283
|
"SupportedCapabilities": dbus.Dictionary(
|
|
285
284
|
{
|
|
286
285
|
"MaxAdvLen": dbus.Byte(251),
|
|
@@ -289,14 +288,12 @@ def AddAdapter(self, device_name, system_name):
|
|
|
289
288
|
"MaxTxPower": dbus.Int16(7),
|
|
290
289
|
},
|
|
291
290
|
signature="sv",
|
|
292
|
-
variant_level=1,
|
|
293
291
|
),
|
|
294
292
|
"SupportedFeatures": dbus.Array(
|
|
295
293
|
[
|
|
296
294
|
"CanSetTxPower",
|
|
297
295
|
"HardwareOffload",
|
|
298
296
|
],
|
|
299
|
-
variant_level=1,
|
|
300
297
|
),
|
|
301
298
|
}
|
|
302
299
|
adapter.AddProperties(LE_ADVERTISING_MANAGER_IFACE, advertising_manager_properties)
|
|
@@ -314,7 +311,7 @@ def AddAdapter(self, device_name, system_name):
|
|
|
314
311
|
# Advertisement Monitor Manager
|
|
315
312
|
if bluez.enable_monitor_api:
|
|
316
313
|
advertisement_monitor_manager_properties = {
|
|
317
|
-
"SupportedMonitorTypes": dbus.Array(["or_patterns"]
|
|
314
|
+
"SupportedMonitorTypes": dbus.Array(["or_patterns"]),
|
|
318
315
|
}
|
|
319
316
|
adapter.AddProperties(ADVERTISEMENT_MONITOR_MANAGER_IFACE, advertisement_monitor_manager_properties)
|
|
320
317
|
adapter.AddMethods(
|
|
@@ -423,7 +420,7 @@ def Connect(device):
|
|
|
423
420
|
[
|
|
424
421
|
DEVICE_IFACE,
|
|
425
422
|
{
|
|
426
|
-
"Connected": dbus.Boolean(device.connected
|
|
423
|
+
"Connected": dbus.Boolean(device.connected),
|
|
427
424
|
},
|
|
428
425
|
[],
|
|
429
426
|
],
|
|
@@ -442,7 +439,7 @@ def Disconnect(device):
|
|
|
442
439
|
[
|
|
443
440
|
DEVICE_IFACE,
|
|
444
441
|
{
|
|
445
|
-
"Connected": dbus.Boolean(device.connected
|
|
442
|
+
"Connected": dbus.Boolean(device.connected),
|
|
446
443
|
},
|
|
447
444
|
[],
|
|
448
445
|
],
|
|
@@ -474,29 +471,29 @@ def AddDevice(self, adapter_device_name, device_address, alias):
|
|
|
474
471
|
)
|
|
475
472
|
|
|
476
473
|
properties = {
|
|
477
|
-
"Address": dbus.String(device_address
|
|
478
|
-
"AddressType": dbus.String("public"
|
|
479
|
-
"Name": dbus.String(alias
|
|
480
|
-
"Icon": dbus.String("phone"
|
|
481
|
-
"Class": dbus.UInt32(MOCK_PHONE_CLASS
|
|
482
|
-
"Appearance": dbus.UInt16(0
|
|
483
|
-
"UUIDs": dbus.Array([], signature="s"
|
|
484
|
-
"Paired": dbus.Boolean(False
|
|
485
|
-
"Connected": dbus.Boolean(False
|
|
486
|
-
"Trusted": dbus.Boolean(False
|
|
487
|
-
"Blocked": dbus.Boolean(False
|
|
488
|
-
"WakeAllowed": dbus.Boolean(False
|
|
489
|
-
"Alias": dbus.String(alias
|
|
490
|
-
"Adapter": dbus.ObjectPath(adapter_path
|
|
491
|
-
"LegacyPairing": dbus.Boolean(False
|
|
492
|
-
"Modalias": dbus.String("bluetooth:v000Fp1200d1436"
|
|
493
|
-
"RSSI": dbus.Int16(-79
|
|
494
|
-
"TxPower": dbus.Int16(0
|
|
495
|
-
"ManufacturerData": dbus.Array([], signature="a{qv}"
|
|
496
|
-
"ServiceData": dbus.Array([], signature="a{sv}"
|
|
497
|
-
"ServicesResolved": dbus.Boolean(False
|
|
498
|
-
"AdvertisingFlags": dbus.Array([], signature="ay"
|
|
499
|
-
"AdvertisingData": dbus.Array([], signature="a{yv}"
|
|
474
|
+
"Address": dbus.String(device_address),
|
|
475
|
+
"AddressType": dbus.String("public"),
|
|
476
|
+
"Name": dbus.String(alias),
|
|
477
|
+
"Icon": dbus.String("phone"),
|
|
478
|
+
"Class": dbus.UInt32(MOCK_PHONE_CLASS),
|
|
479
|
+
"Appearance": dbus.UInt16(0),
|
|
480
|
+
"UUIDs": dbus.Array([], signature="s"),
|
|
481
|
+
"Paired": dbus.Boolean(False),
|
|
482
|
+
"Connected": dbus.Boolean(False),
|
|
483
|
+
"Trusted": dbus.Boolean(False),
|
|
484
|
+
"Blocked": dbus.Boolean(False),
|
|
485
|
+
"WakeAllowed": dbus.Boolean(False),
|
|
486
|
+
"Alias": dbus.String(alias),
|
|
487
|
+
"Adapter": dbus.ObjectPath(adapter_path),
|
|
488
|
+
"LegacyPairing": dbus.Boolean(False),
|
|
489
|
+
"Modalias": dbus.String("bluetooth:v000Fp1200d1436"),
|
|
490
|
+
"RSSI": dbus.Int16(-79), # arbitrary
|
|
491
|
+
"TxPower": dbus.Int16(0),
|
|
492
|
+
"ManufacturerData": dbus.Array([], signature="a{qv}"),
|
|
493
|
+
"ServiceData": dbus.Array([], signature="a{sv}"),
|
|
494
|
+
"ServicesResolved": dbus.Boolean(False),
|
|
495
|
+
"AdvertisingFlags": dbus.Array([], signature="ay"),
|
|
496
|
+
"AdvertisingData": dbus.Array([], signature="a{yv}"),
|
|
500
497
|
}
|
|
501
498
|
|
|
502
499
|
self.AddObject(
|
|
@@ -579,10 +576,10 @@ def PairDevice(_self, adapter_device_name, device_address):
|
|
|
579
576
|
device.UpdateProperties(
|
|
580
577
|
DEVICE_IFACE,
|
|
581
578
|
{
|
|
582
|
-
"UUIDs": dbus.Array(uuids
|
|
583
|
-
"Paired": dbus.Boolean(True
|
|
584
|
-
"LegacyPairing": dbus.Boolean(True
|
|
585
|
-
"Blocked": dbus.Boolean(False
|
|
579
|
+
"UUIDs": dbus.Array(uuids),
|
|
580
|
+
"Paired": dbus.Boolean(True),
|
|
581
|
+
"LegacyPairing": dbus.Boolean(True),
|
|
582
|
+
"Blocked": dbus.Boolean(False),
|
|
586
583
|
},
|
|
587
584
|
)
|
|
588
585
|
|
|
@@ -617,8 +614,8 @@ def BlockDevice(_self, adapter_device_name, device_address):
|
|
|
617
614
|
|
|
618
615
|
device = mockobject.objects[device_path]
|
|
619
616
|
|
|
620
|
-
device.props[DEVICE_IFACE]["Blocked"] = dbus.Boolean(True
|
|
621
|
-
device.props[DEVICE_IFACE]["Connected"] = dbus.Boolean(False
|
|
617
|
+
device.props[DEVICE_IFACE]["Blocked"] = dbus.Boolean(True)
|
|
618
|
+
device.props[DEVICE_IFACE]["Connected"] = dbus.Boolean(False)
|
|
622
619
|
|
|
623
620
|
device.EmitSignal(
|
|
624
621
|
dbus.PROPERTIES_IFACE,
|
|
@@ -627,8 +624,8 @@ def BlockDevice(_self, adapter_device_name, device_address):
|
|
|
627
624
|
[
|
|
628
625
|
DEVICE_IFACE,
|
|
629
626
|
{
|
|
630
|
-
"Blocked": dbus.Boolean(True
|
|
631
|
-
"Connected": dbus.Boolean(False
|
|
627
|
+
"Blocked": dbus.Boolean(True),
|
|
628
|
+
"Connected": dbus.Boolean(False),
|
|
632
629
|
},
|
|
633
630
|
[],
|
|
634
631
|
],
|
|
@@ -665,8 +662,8 @@ def ConnectDevice(_self, adapter_device_name, device_address):
|
|
|
665
662
|
|
|
666
663
|
device = mockobject.objects[device_path]
|
|
667
664
|
|
|
668
|
-
device.props[DEVICE_IFACE]["Blocked"] = dbus.Boolean(False
|
|
669
|
-
device.props[DEVICE_IFACE]["Connected"] = dbus.Boolean(True
|
|
665
|
+
device.props[DEVICE_IFACE]["Blocked"] = dbus.Boolean(False)
|
|
666
|
+
device.props[DEVICE_IFACE]["Connected"] = dbus.Boolean(True)
|
|
670
667
|
|
|
671
668
|
device.EmitSignal(
|
|
672
669
|
dbus.PROPERTIES_IFACE,
|
|
@@ -675,8 +672,8 @@ def ConnectDevice(_self, adapter_device_name, device_address):
|
|
|
675
672
|
[
|
|
676
673
|
DEVICE_IFACE,
|
|
677
674
|
{
|
|
678
|
-
"Blocked": dbus.Boolean(False
|
|
679
|
-
"Connected": dbus.Boolean(True
|
|
675
|
+
"Blocked": dbus.Boolean(False),
|
|
676
|
+
"Connected": dbus.Boolean(True),
|
|
680
677
|
},
|
|
681
678
|
[],
|
|
682
679
|
],
|
|
@@ -713,7 +710,7 @@ def DisconnectDevice(_self, adapter_device_name, device_address):
|
|
|
713
710
|
|
|
714
711
|
device = mockobject.objects[device_path]
|
|
715
712
|
|
|
716
|
-
device.props[DEVICE_IFACE]["Connected"] = dbus.Boolean(False
|
|
713
|
+
device.props[DEVICE_IFACE]["Connected"] = dbus.Boolean(False)
|
|
717
714
|
|
|
718
715
|
device.EmitSignal(
|
|
719
716
|
dbus.PROPERTIES_IFACE,
|
|
@@ -722,7 +719,7 @@ def DisconnectDevice(_self, adapter_device_name, device_address):
|
|
|
722
719
|
[
|
|
723
720
|
DEVICE_IFACE,
|
|
724
721
|
{
|
|
725
|
-
"Connected": dbus.Boolean(False
|
|
722
|
+
"Connected": dbus.Boolean(False),
|
|
726
723
|
},
|
|
727
724
|
[],
|
|
728
725
|
],
|
|
@@ -778,14 +775,13 @@ def AddAdvertisement(self, adv_name):
|
|
|
778
775
|
path = "/org/dbusmock/bluez/advertisement/" + adv_name
|
|
779
776
|
|
|
780
777
|
adv_properties = {
|
|
781
|
-
"Type": dbus.String("broadcast"
|
|
778
|
+
"Type": dbus.String("broadcast"),
|
|
782
779
|
"ManufacturerData": dbus.Dictionary(
|
|
783
780
|
# 0xFFFF is the Bluetooth Company Identifier reserved for internal use and testing.
|
|
784
|
-
{dbus.UInt16(0xFFFF): dbus.Array([0x00, 0x01]
|
|
781
|
+
{dbus.UInt16(0xFFFF): dbus.Array([0x00, 0x01])},
|
|
785
782
|
signature="qv",
|
|
786
|
-
variant_level=1,
|
|
787
783
|
),
|
|
788
|
-
"Includes": dbus.Array(["local-name"]
|
|
784
|
+
"Includes": dbus.Array(["local-name"]),
|
|
789
785
|
}
|
|
790
786
|
|
|
791
787
|
self.AddObject(
|
|
@@ -809,7 +805,7 @@ def AddMonitor(self, monitor_name):
|
|
|
809
805
|
path = "/org/dbusmock/bluez/monitor/" + monitor_name
|
|
810
806
|
|
|
811
807
|
monitor_properties = {
|
|
812
|
-
"Type": dbus.String("or_patterns"
|
|
808
|
+
"Type": dbus.String("or_patterns"),
|
|
813
809
|
# Example pattern that could be used to scan for an advertisement created by AddAdvertisement()
|
|
814
810
|
"Patterns": dbus.Struct(
|
|
815
811
|
(
|
|
@@ -826,7 +822,6 @@ def AddMonitor(self, monitor_name):
|
|
|
826
822
|
),
|
|
827
823
|
),
|
|
828
824
|
signature="yyay",
|
|
829
|
-
variant_level=2,
|
|
830
825
|
),
|
|
831
826
|
}
|
|
832
827
|
|
|
@@ -155,7 +155,7 @@ def AddSimpleModem(self):
|
|
|
155
155
|
self.AddObject(modem_path, MODEM_IFACE, modem_props, [])
|
|
156
156
|
|
|
157
157
|
modem_3gpp_props = {
|
|
158
|
-
"Imei": dbus.String("doesnotmatter"
|
|
158
|
+
"Imei": dbus.String("doesnotmatter"),
|
|
159
159
|
"OperatorName": dbus.String("TheOperator"),
|
|
160
160
|
"Pco": dbus.Array([], signature="(ubay)"),
|
|
161
161
|
}
|
|
@@ -285,20 +285,18 @@ def SetProperty(_self, path, iface, name, value):
|
|
|
285
285
|
|
|
286
286
|
@dbus.service.method(MOCK_IFACE, in_signature="u", out_signature="")
|
|
287
287
|
def SetGlobalConnectionState(self, state):
|
|
288
|
-
self.SetProperty(MANAGER_OBJ, MANAGER_IFACE, "State", dbus.UInt32(state
|
|
288
|
+
self.SetProperty(MANAGER_OBJ, MANAGER_IFACE, "State", dbus.UInt32(state))
|
|
289
289
|
self.EmitSignal(MANAGER_IFACE, "StateChanged", "u", [state])
|
|
290
290
|
|
|
291
291
|
|
|
292
292
|
@dbus.service.method(MOCK_IFACE, in_signature="u", out_signature="")
|
|
293
293
|
def SetConnectivity(self, connectivity):
|
|
294
|
-
self.SetProperty(MANAGER_OBJ, MANAGER_IFACE, "Connectivity", dbus.UInt32(connectivity
|
|
294
|
+
self.SetProperty(MANAGER_OBJ, MANAGER_IFACE, "Connectivity", dbus.UInt32(connectivity))
|
|
295
295
|
|
|
296
296
|
|
|
297
297
|
@dbus.service.method(MOCK_IFACE, in_signature="b", out_signature="")
|
|
298
298
|
def SetNetworkingEnabled(self, networking_enabled):
|
|
299
|
-
self.SetProperty(
|
|
300
|
-
MANAGER_OBJ, MANAGER_IFACE, "NetworkingEnabled", dbus.Boolean(networking_enabled, variant_level=1)
|
|
301
|
-
)
|
|
299
|
+
self.SetProperty(MANAGER_OBJ, MANAGER_IFACE, "NetworkingEnabled", dbus.Boolean(networking_enabled))
|
|
302
300
|
|
|
303
301
|
|
|
304
302
|
@dbus.service.method(MOCK_IFACE, in_signature="ss", out_signature="")
|
|
@@ -82,15 +82,15 @@ def AddModem(self, name, _properties):
|
|
|
82
82
|
path,
|
|
83
83
|
"org.ofono.Modem",
|
|
84
84
|
{
|
|
85
|
-
"Online": dbus.Boolean(True
|
|
86
|
-
"Powered": dbus.Boolean(True
|
|
87
|
-
"Lockdown": dbus.Boolean(False
|
|
88
|
-
"Emergency": dbus.Boolean(False
|
|
89
|
-
"Manufacturer": dbus.String("Fakesys"
|
|
90
|
-
"Model": dbus.String("Mock Modem"
|
|
91
|
-
"Revision": dbus.String("0815.42"
|
|
92
|
-
"Serial": dbus.String(new_modem_serial(self)
|
|
93
|
-
"Type": dbus.String("hardware"
|
|
85
|
+
"Online": dbus.Boolean(True),
|
|
86
|
+
"Powered": dbus.Boolean(True),
|
|
87
|
+
"Lockdown": dbus.Boolean(False),
|
|
88
|
+
"Emergency": dbus.Boolean(False),
|
|
89
|
+
"Manufacturer": dbus.String("Fakesys"),
|
|
90
|
+
"Model": dbus.String("Mock Modem"),
|
|
91
|
+
"Revision": dbus.String("0815.42"),
|
|
92
|
+
"Serial": dbus.String(new_modem_serial(self)),
|
|
93
|
+
"Type": dbus.String("hardware"),
|
|
94
94
|
"Interfaces": [
|
|
95
95
|
"org.ofono.CallVolume",
|
|
96
96
|
"org.ofono.VoiceCallManager",
|
|
@@ -220,13 +220,13 @@ def Dial(self, number, _hide_callerid):
|
|
|
220
220
|
path,
|
|
221
221
|
"org.ofono.VoiceCall",
|
|
222
222
|
{
|
|
223
|
-
"State": dbus.String("dialing"
|
|
224
|
-
"LineIdentification": dbus.String(number
|
|
225
|
-
"Name": dbus.String(""
|
|
226
|
-
"Multiparty": dbus.Boolean(False
|
|
227
|
-
"RemoteHeld": dbus.Boolean(False
|
|
228
|
-
"RemoteMultiparty": dbus.Boolean(False
|
|
229
|
-
"Emergency": dbus.Boolean(False
|
|
223
|
+
"State": dbus.String("dialing"),
|
|
224
|
+
"LineIdentification": dbus.String(number),
|
|
225
|
+
"Name": dbus.String(""),
|
|
226
|
+
"Multiparty": dbus.Boolean(False),
|
|
227
|
+
"RemoteHeld": dbus.Boolean(False),
|
|
228
|
+
"RemoteMultiparty": dbus.Boolean(False),
|
|
229
|
+
"Emergency": dbus.Boolean(False),
|
|
230
230
|
},
|
|
231
231
|
[
|
|
232
232
|
("GetProperties", "", "a{sv}", 'ret = self.GetAll("org.ofono.VoiceCall")'),
|
|
@@ -73,18 +73,18 @@ def load(mock, parameters):
|
|
|
73
73
|
mock.p_display_dev,
|
|
74
74
|
DEVICE_IFACE,
|
|
75
75
|
{
|
|
76
|
-
"Type": dbus.UInt32(0
|
|
77
|
-
"State": dbus.UInt32(0
|
|
78
|
-
"Percentage": dbus.Double(0.0
|
|
79
|
-
"Energy": dbus.Double(0.0
|
|
80
|
-
"EnergyFull": dbus.Double(0.0
|
|
81
|
-
"EnergyRate": dbus.Double(0.0
|
|
82
|
-
"TimeToEmpty": dbus.Int64(0
|
|
83
|
-
"TimeToFull": dbus.Int64(0
|
|
84
|
-
"IsPresent": dbus.Boolean(False
|
|
85
|
-
"IconName": dbus.String(""
|
|
76
|
+
"Type": dbus.UInt32(0),
|
|
77
|
+
"State": dbus.UInt32(0),
|
|
78
|
+
"Percentage": dbus.Double(0.0),
|
|
79
|
+
"Energy": dbus.Double(0.0),
|
|
80
|
+
"EnergyFull": dbus.Double(0.0),
|
|
81
|
+
"EnergyRate": dbus.Double(0.0),
|
|
82
|
+
"TimeToEmpty": dbus.Int64(0),
|
|
83
|
+
"TimeToFull": dbus.Int64(0),
|
|
84
|
+
"IsPresent": dbus.Boolean(False),
|
|
85
|
+
"IconName": dbus.String(""),
|
|
86
86
|
# LEVEL_NONE
|
|
87
|
-
"WarningLevel": dbus.UInt32(1
|
|
87
|
+
"WarningLevel": dbus.UInt32(1),
|
|
88
88
|
},
|
|
89
89
|
[
|
|
90
90
|
("Refresh", "", "", ""),
|
|
@@ -111,9 +111,9 @@ def AddAC(self, device_name, model_name):
|
|
|
111
111
|
path,
|
|
112
112
|
DEVICE_IFACE,
|
|
113
113
|
{
|
|
114
|
-
"PowerSupply": dbus.Boolean(True
|
|
115
|
-
"Model": dbus.String(model_name
|
|
116
|
-
"Online": dbus.Boolean(True
|
|
114
|
+
"PowerSupply": dbus.Boolean(True),
|
|
115
|
+
"Model": dbus.String(model_name),
|
|
116
|
+
"Online": dbus.Boolean(True),
|
|
117
117
|
},
|
|
118
118
|
[],
|
|
119
119
|
)
|
|
@@ -139,17 +139,17 @@ def AddDischargingBattery(self, device_name, model_name, percentage, seconds_to_
|
|
|
139
139
|
path,
|
|
140
140
|
DEVICE_IFACE,
|
|
141
141
|
{
|
|
142
|
-
"PowerSupply": dbus.Boolean(True
|
|
143
|
-
"IsPresent": dbus.Boolean(True
|
|
144
|
-
"Model": dbus.String(model_name
|
|
145
|
-
"Percentage": dbus.Double(percentage
|
|
146
|
-
"TimeToEmpty": dbus.Int64(seconds_to_empty
|
|
147
|
-
"EnergyFull": dbus.Double(100.0
|
|
148
|
-
"Energy": dbus.Double(percentage
|
|
142
|
+
"PowerSupply": dbus.Boolean(True),
|
|
143
|
+
"IsPresent": dbus.Boolean(True),
|
|
144
|
+
"Model": dbus.String(model_name),
|
|
145
|
+
"Percentage": dbus.Double(percentage),
|
|
146
|
+
"TimeToEmpty": dbus.Int64(seconds_to_empty),
|
|
147
|
+
"EnergyFull": dbus.Double(100.0),
|
|
148
|
+
"Energy": dbus.Double(percentage),
|
|
149
149
|
# UP_DEVICE_STATE_DISCHARGING
|
|
150
|
-
"State": dbus.UInt32(2
|
|
150
|
+
"State": dbus.UInt32(2),
|
|
151
151
|
# UP_DEVICE_KIND_BATTERY
|
|
152
|
-
"Type": dbus.UInt32(2
|
|
152
|
+
"Type": dbus.UInt32(2),
|
|
153
153
|
},
|
|
154
154
|
[],
|
|
155
155
|
)
|
|
@@ -175,17 +175,17 @@ def AddChargingBattery(self, device_name, model_name, percentage, seconds_to_ful
|
|
|
175
175
|
path,
|
|
176
176
|
DEVICE_IFACE,
|
|
177
177
|
{
|
|
178
|
-
"PowerSupply": dbus.Boolean(True
|
|
179
|
-
"IsPresent": dbus.Boolean(True
|
|
180
|
-
"Model": dbus.String(model_name
|
|
181
|
-
"Percentage": dbus.Double(percentage
|
|
182
|
-
"TimeToFull": dbus.Int64(seconds_to_full
|
|
183
|
-
"EnergyFull": dbus.Double(100.0
|
|
184
|
-
"Energy": dbus.Double(percentage
|
|
178
|
+
"PowerSupply": dbus.Boolean(True),
|
|
179
|
+
"IsPresent": dbus.Boolean(True),
|
|
180
|
+
"Model": dbus.String(model_name),
|
|
181
|
+
"Percentage": dbus.Double(percentage),
|
|
182
|
+
"TimeToFull": dbus.Int64(seconds_to_full),
|
|
183
|
+
"EnergyFull": dbus.Double(100.0),
|
|
184
|
+
"Energy": dbus.Double(percentage),
|
|
185
185
|
# UP_DEVICE_STATE_CHARGING
|
|
186
|
-
"State": dbus.UInt32(1
|
|
186
|
+
"State": dbus.UInt32(1),
|
|
187
187
|
# UP_DEVICE_KIND_BATTERY
|
|
188
|
-
"Type": dbus.UInt32(2
|
|
188
|
+
"Type": dbus.UInt32(2),
|
|
189
189
|
},
|
|
190
190
|
[],
|
|
191
191
|
)
|
|
@@ -12,7 +12,7 @@ actions:
|
|
|
12
12
|
create-archive:
|
|
13
13
|
- ./setup.py sdist
|
|
14
14
|
# spec and tarball need to be in the same directory
|
|
15
|
-
- sh -c 'mv dist/*.tar.* packaging; ls packaging/python-dbusmock-*.tar.*'
|
|
15
|
+
- sh -c 'mv dist/*.tar.* packaging; ls packaging/python[-_]dbusmock-*.tar.*'
|
|
16
16
|
|
|
17
17
|
srpm_build_deps:
|
|
18
18
|
- python3-setuptools
|
|
@@ -36,8 +36,7 @@ packages = ["dbusmock", "dbusmock.templates"]
|
|
|
36
36
|
|
|
37
37
|
[tool.setuptools_scm]
|
|
38
38
|
write_to = "dbusmock/_version.py"
|
|
39
|
-
|
|
40
|
-
write_to_template = """'''auto-generated version from setuptools_scm'''
|
|
39
|
+
write_to_template = """
|
|
41
40
|
__version__ = "{version}"
|
|
42
41
|
"""
|
|
43
42
|
version_scheme = 'post-release'
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
summary: smoke test
|
|
2
|
-
duration:
|
|
2
|
+
duration: 1m
|
|
3
3
|
require:
|
|
4
4
|
- python3-dbusmock
|
|
5
5
|
test: |
|
|
6
|
-
set -eux
|
|
6
|
+
set -eux -o pipefail
|
|
7
7
|
python3 -m dbusmock com.example.Foo / com.example.Foo.Manager &
|
|
8
8
|
MOCK=$!
|
|
9
9
|
trap "kill $MOCK; wait $MOCK || true" EXIT INT QUIT PIPE
|
|
10
10
|
|
|
11
|
-
until busctl list --user | grep -q com.example.Foo; do sleep 0.
|
|
11
|
+
until busctl list --user | grep -q com.example.Foo; do sleep 0.5; done
|
|
12
12
|
|
|
13
13
|
busctl call --user com.example.Foo / org.freedesktop.DBus.Mock AddMethod sssss '' 'Ping' '' '' ''
|
|
14
14
|
busctl introspect --user com.example.Foo / com.example.Foo.Manager | grep Ping
|
|
@@ -44,7 +44,7 @@ class TestAPI(dbusmock.DBusTestCase):
|
|
|
44
44
|
|
|
45
45
|
def setUp(self):
|
|
46
46
|
# pylint: disable=consider-using-with
|
|
47
|
-
self.mock_log = tempfile.NamedTemporaryFile()
|
|
47
|
+
self.mock_log = tempfile.NamedTemporaryFile() # noqa: SIM115
|
|
48
48
|
self.p_mock = self.spawn_server(
|
|
49
49
|
"org.freedesktop.Test", "/", "org.freedesktop.Test.Main", stdout=self.mock_log
|
|
50
50
|
)
|
|
@@ -236,8 +236,8 @@ assert args[2] == 5
|
|
|
236
236
|
"/obj1",
|
|
237
237
|
"org.freedesktop.Test.Sub",
|
|
238
238
|
{
|
|
239
|
-
"state": dbus.String("online"
|
|
240
|
-
"cute": dbus.Boolean(True
|
|
239
|
+
"state": dbus.String("online"),
|
|
240
|
+
"cute": dbus.Boolean(True),
|
|
241
241
|
},
|
|
242
242
|
[],
|
|
243
243
|
)
|
|
@@ -276,8 +276,8 @@ assert args[2] == 5
|
|
|
276
276
|
"/obj1",
|
|
277
277
|
"org.freedesktop.Test.Sub",
|
|
278
278
|
{
|
|
279
|
-
"state": dbus.String("online"
|
|
280
|
-
"cute": dbus.Boolean(True
|
|
279
|
+
"state": dbus.String("online"),
|
|
280
|
+
"cute": dbus.Boolean(True),
|
|
281
281
|
},
|
|
282
282
|
[
|
|
283
283
|
("Do0", "", "i", "ret = 42"),
|
|
@@ -308,12 +308,12 @@ assert args[2] == 5
|
|
|
308
308
|
self.dbus_props.Set,
|
|
309
309
|
"org.freedesktop.Test.Main",
|
|
310
310
|
"version",
|
|
311
|
-
dbus.Int32(2
|
|
311
|
+
dbus.Int32(2),
|
|
312
312
|
)
|
|
313
313
|
|
|
314
|
-
self.dbus_mock.AddProperty("org.freedesktop.Test.Main", "version", dbus.Int32(2
|
|
314
|
+
self.dbus_mock.AddProperty("org.freedesktop.Test.Main", "version", dbus.Int32(2))
|
|
315
315
|
# once again on default interface
|
|
316
|
-
self.dbus_mock.AddProperty("", "connected", dbus.Boolean(True
|
|
316
|
+
self.dbus_mock.AddProperty("", "connected", dbus.Boolean(True))
|
|
317
317
|
|
|
318
318
|
self.assertEqual(self.dbus_props.Get("org.freedesktop.Test.Main", "version"), 2)
|
|
319
319
|
self.assertEqual(self.dbus_props.Get("org.freedesktop.Test.Main", "connected"), True)
|
|
@@ -326,7 +326,7 @@ assert args[2] == 5
|
|
|
326
326
|
self.assertEqual(ctx.exception.get_dbus_message(), "no such interface org.freedesktop.Test.Bogus")
|
|
327
327
|
|
|
328
328
|
# change property
|
|
329
|
-
self.dbus_props.Set("org.freedesktop.Test.Main", "version", dbus.Int32(4
|
|
329
|
+
self.dbus_props.Set("org.freedesktop.Test.Main", "version", dbus.Int32(4))
|
|
330
330
|
self.assertEqual(self.dbus_props.Get("org.freedesktop.Test.Main", "version"), 4)
|
|
331
331
|
|
|
332
332
|
# check that the Get/Set calls get logged
|
|
@@ -337,7 +337,7 @@ assert args[2] == 5
|
|
|
337
337
|
self.assertRegex(log, "\n[0-9.]+ Set / org.freedesktop.Test.Main.version 4\n")
|
|
338
338
|
|
|
339
339
|
# add property to different interface
|
|
340
|
-
self.dbus_mock.AddProperty("org.freedesktop.Test.Other", "color", dbus.String("yellow"
|
|
340
|
+
self.dbus_mock.AddProperty("org.freedesktop.Test.Other", "color", dbus.String("yellow"))
|
|
341
341
|
|
|
342
342
|
self.assertEqual(self.dbus_props.GetAll("org.freedesktop.Test.Main"), {"version": 4, "connected": True})
|
|
343
343
|
self.assertEqual(self.dbus_props.GetAll("org.freedesktop.Test.Other"), {"color": "yellow"})
|
|
@@ -18,6 +18,7 @@ import sys
|
|
|
18
18
|
import time
|
|
19
19
|
import tracemalloc
|
|
20
20
|
import unittest
|
|
21
|
+
import xml.etree.ElementTree as ET
|
|
21
22
|
from pathlib import Path
|
|
22
23
|
|
|
23
24
|
import dbus
|
|
@@ -33,6 +34,8 @@ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
|
|
33
34
|
have_bluetoothctl = shutil.which("bluetoothctl")
|
|
34
35
|
have_pbap_client = shutil.which("pbap-client")
|
|
35
36
|
|
|
37
|
+
el10 = "platform:el10" in Path("/etc/os-release").read_text("UTF-8")
|
|
38
|
+
|
|
36
39
|
|
|
37
40
|
def _run_bluetoothctl(command):
|
|
38
41
|
"""Run bluetoothctl with the given command.
|
|
@@ -80,6 +83,18 @@ def _run_bluetoothctl(command):
|
|
|
80
83
|
return list(filter(lambda line: line not in ["list", command, "quit"], lines))
|
|
81
84
|
|
|
82
85
|
|
|
86
|
+
def _introspect_property_types(obj, interface):
|
|
87
|
+
dbus_introspect = dbus.Interface(obj, dbus.INTROSPECTABLE_IFACE)
|
|
88
|
+
xml = dbus_introspect.Introspect()
|
|
89
|
+
root = ET.fromstring(xml)
|
|
90
|
+
|
|
91
|
+
prop_types = {}
|
|
92
|
+
for prop in root.findall(f'./interface[@name="{interface}"]/property'):
|
|
93
|
+
name, type_sig = prop.attrib["name"], prop.attrib["type"]
|
|
94
|
+
prop_types[name] = type_sig
|
|
95
|
+
return prop_types
|
|
96
|
+
|
|
97
|
+
|
|
83
98
|
@unittest.skipUnless(have_bluetoothctl, "bluetoothctl not installed")
|
|
84
99
|
class TestBlueZ5(dbusmock.DBusTestCase):
|
|
85
100
|
"""Test mocking bluetoothd"""
|
|
@@ -171,6 +186,58 @@ class TestBlueZ5(dbusmock.DBusTestCase):
|
|
|
171
186
|
self.assertIn("Advertisement Monitor Features:", out)
|
|
172
187
|
self.assertIn("SupportedMonitorTypes: or_patterns", out)
|
|
173
188
|
|
|
189
|
+
def test_adapter_property_types(self):
|
|
190
|
+
adapter_name = "hci0"
|
|
191
|
+
system_name = "my-computer"
|
|
192
|
+
|
|
193
|
+
path = self.dbusmock_bluez.AddAdapter(adapter_name, system_name)
|
|
194
|
+
self.assertEqual(path, "/org/bluez/" + adapter_name)
|
|
195
|
+
|
|
196
|
+
# Test that the property types on the interfaces are defined correctly
|
|
197
|
+
adapter = self.dbus_con.get_object("org.bluez", path)
|
|
198
|
+
|
|
199
|
+
adapter_prop_types = _introspect_property_types(adapter, "org.bluez.Adapter1")
|
|
200
|
+
self.assertEqual(
|
|
201
|
+
adapter_prop_types,
|
|
202
|
+
{
|
|
203
|
+
"Address": "s",
|
|
204
|
+
"AddressType": "s",
|
|
205
|
+
"Alias": "s",
|
|
206
|
+
"Class": "u",
|
|
207
|
+
"Discoverable": "b",
|
|
208
|
+
"DiscoverableTimeout": "u",
|
|
209
|
+
"Discovering": "b",
|
|
210
|
+
"Modalias": "s",
|
|
211
|
+
"Name": "s",
|
|
212
|
+
"Pairable": "b",
|
|
213
|
+
"PairableTimeout": "u",
|
|
214
|
+
"Powered": "b",
|
|
215
|
+
"Roles": "as",
|
|
216
|
+
"UUIDs": "as",
|
|
217
|
+
},
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
adv_manager_prop_types = _introspect_property_types(adapter, "org.bluez.LEAdvertisingManager1")
|
|
221
|
+
self.assertEqual(
|
|
222
|
+
adv_manager_prop_types,
|
|
223
|
+
{
|
|
224
|
+
"ActiveInstances": "y",
|
|
225
|
+
"SupportedCapabilities": "a{sv}",
|
|
226
|
+
"SupportedFeatures": "as",
|
|
227
|
+
"SupportedIncludes": "as",
|
|
228
|
+
"SupportedInstances": "y",
|
|
229
|
+
"SupportedSecondaryChannels": "as",
|
|
230
|
+
},
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
adv_monitor_manager_prop_types = _introspect_property_types(adapter, "org.bluez.AdvertisementMonitorManager1")
|
|
234
|
+
self.assertEqual(
|
|
235
|
+
adv_monitor_manager_prop_types,
|
|
236
|
+
{
|
|
237
|
+
"SupportedMonitorTypes": "as",
|
|
238
|
+
},
|
|
239
|
+
)
|
|
240
|
+
|
|
174
241
|
def test_no_devices(self):
|
|
175
242
|
# Add an adapter.
|
|
176
243
|
adapter_name = "hci0"
|
|
@@ -236,7 +303,7 @@ class TestBlueZ5(dbusmock.DBusTestCase):
|
|
|
236
303
|
self.assertEqual(adv_path, "/org/dbusmock/bluez/advertisement/bc001")
|
|
237
304
|
# And the object is exported on the bus
|
|
238
305
|
adv = self.dbus_con.get_object("org.bluez", adv_path)
|
|
239
|
-
adv_type = adv.Get("org.bluez.LEAdvertisement1", "Type", dbus_interface=
|
|
306
|
+
adv_type = adv.Get("org.bluez.LEAdvertisement1", "Type", dbus_interface=dbus.PROPERTIES_IFACE)
|
|
240
307
|
# And has the correct properties
|
|
241
308
|
self.assertEqual(adv_type, "broadcast")
|
|
242
309
|
|
|
@@ -245,7 +312,7 @@ class TestBlueZ5(dbusmock.DBusTestCase):
|
|
|
245
312
|
path = self.dbusmock_bluez.AddAdapter("hci0", "my-computer")
|
|
246
313
|
adapter = self.dbus_con.get_object("org.bluez", path)
|
|
247
314
|
adv_manager = dbus.Interface(adapter, "org.bluez.LEAdvertisingManager1")
|
|
248
|
-
props = dbus.Interface(adapter,
|
|
315
|
+
props = dbus.Interface(adapter, dbus.PROPERTIES_IFACE)
|
|
249
316
|
active_instances = props.Get(adv_manager.dbus_interface, "ActiveInstances")
|
|
250
317
|
supported_instances = props.Get(adv_manager.dbus_interface, "SupportedInstances")
|
|
251
318
|
|
|
@@ -269,7 +336,7 @@ class TestBlueZ5(dbusmock.DBusTestCase):
|
|
|
269
336
|
path = self.dbusmock_bluez.AddAdapter("hci0", "my-computer")
|
|
270
337
|
adapter = self.dbus_con.get_object("org.bluez", path)
|
|
271
338
|
adv_manager = dbus.Interface(adapter, "org.bluez.LEAdvertisingManager1")
|
|
272
|
-
props = dbus.Interface(adapter,
|
|
339
|
+
props = dbus.Interface(adapter, dbus.PROPERTIES_IFACE)
|
|
273
340
|
|
|
274
341
|
# When an advertisement is registered twice
|
|
275
342
|
adv_manager.RegisterAdvertisement("/adv0", {})
|
|
@@ -291,7 +358,7 @@ class TestBlueZ5(dbusmock.DBusTestCase):
|
|
|
291
358
|
path = self.dbusmock_bluez.AddAdapter("hci0", "my-computer")
|
|
292
359
|
adapter = self.dbus_con.get_object("org.bluez", path)
|
|
293
360
|
adv_manager = dbus.Interface(adapter, "org.bluez.LEAdvertisingManager1")
|
|
294
|
-
props = dbus.Interface(adapter,
|
|
361
|
+
props = dbus.Interface(adapter, dbus.PROPERTIES_IFACE)
|
|
295
362
|
max_instances = props.Get(adv_manager.dbus_interface, "SupportedInstances")
|
|
296
363
|
|
|
297
364
|
# When more advertisements are registered than supported
|
|
@@ -315,7 +382,7 @@ class TestBlueZ5(dbusmock.DBusTestCase):
|
|
|
315
382
|
path = self.dbusmock_bluez.AddAdapter("hci0", "my-computer")
|
|
316
383
|
adapter = self.dbus_con.get_object("org.bluez", path)
|
|
317
384
|
adv_manager = dbus.Interface(adapter, "org.bluez.LEAdvertisingManager1")
|
|
318
|
-
props = dbus.Interface(adapter,
|
|
385
|
+
props = dbus.Interface(adapter, dbus.PROPERTIES_IFACE)
|
|
319
386
|
|
|
320
387
|
# And a registered advertisement
|
|
321
388
|
adv_manager.RegisterAdvertisement("/adv0", {})
|
|
@@ -353,9 +420,7 @@ class TestBlueZ5(dbusmock.DBusTestCase):
|
|
|
353
420
|
self.assertEqual(adv_path, "/org/dbusmock/bluez/monitor/mon001")
|
|
354
421
|
# And the object is exported on the bus
|
|
355
422
|
adv = self.dbus_con.get_object("org.bluez", adv_path)
|
|
356
|
-
adv_type = adv.Get(
|
|
357
|
-
"org.bluez.AdvertisementMonitor1", "Type", dbus_interface="org.freedesktop.DBus.Properties"
|
|
358
|
-
)
|
|
423
|
+
adv_type = adv.Get("org.bluez.AdvertisementMonitor1", "Type", dbus_interface=dbus.PROPERTIES_IFACE)
|
|
359
424
|
# And has the correct properties
|
|
360
425
|
self.assertEqual(adv_type, "or_patterns")
|
|
361
426
|
|
|
@@ -407,6 +472,7 @@ class TestBlueZ5(dbusmock.DBusTestCase):
|
|
|
407
472
|
adv_monitor_manager.UnregisterMonitor("/monitor0")
|
|
408
473
|
self.assertEqual(ctx.exception.get_dbus_name(), "org.bluez.Error.DoesNotExist")
|
|
409
474
|
|
|
475
|
+
@unittest.skipIf(el10, "https://issues.redhat.com/browse/RHEL-56021")
|
|
410
476
|
def test_advertise(self):
|
|
411
477
|
# Given an adapter with the LEAdvertisingManager1 interface
|
|
412
478
|
path = self.dbusmock_bluez.AddAdapter("hci0", "my-computer")
|
|
@@ -48,6 +48,7 @@ class StaticCodeTests(unittest.TestCase):
|
|
|
48
48
|
"--disable=missing-module-docstring,missing-class-docstring",
|
|
49
49
|
"--disable=missing-function-docstring",
|
|
50
50
|
"--disable=too-many-public-methods,too-many-lines,too-many-statements,R0801",
|
|
51
|
+
"--disable=fixme",
|
|
51
52
|
"tests/",
|
|
52
53
|
]
|
|
53
54
|
)
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
""" Tests for accounts service """
|
|
2
|
-
|
|
3
1
|
# This program is free software; you can redistribute it and/or modify it under
|
|
4
2
|
# the terms of the GNU Lesser General Public License as published by the Free
|
|
5
3
|
# Software Foundation; either version 3 of the License, or (at your option) any
|
|
@@ -113,7 +113,7 @@ class TestLogind(dbusmock.DBusTestCase):
|
|
|
113
113
|
|
|
114
114
|
def test_properties(self):
|
|
115
115
|
(self.p_mock, obj_logind) = self.spawn_server_template("logind", {}, stdout=subprocess.PIPE)
|
|
116
|
-
props = obj_logind.GetAll("org.freedesktop.login1.Manager", interface=
|
|
116
|
+
props = obj_logind.GetAll("org.freedesktop.login1.Manager", interface=dbus.PROPERTIES_IFACE)
|
|
117
117
|
self.assertEqual(props["PreparingForSleep"], False)
|
|
118
118
|
self.assertEqual(props["IdleSinceHint"], 0)
|
|
119
119
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
""" Tests for accounts service """
|
|
2
|
-
|
|
3
1
|
# This program is free software; you can redistribute it and/or modify it under
|
|
4
2
|
# the terms of the GNU Lesser General Public License as published by the Free
|
|
5
3
|
# Software Foundation; either version 3 of the License, or (at your option) any
|
|
@@ -35,6 +35,7 @@ from dbusmock.templates.networkmanager import (
|
|
|
35
35
|
NMConnectivityState,
|
|
36
36
|
NMState,
|
|
37
37
|
)
|
|
38
|
+
from packaging.version import Version
|
|
38
39
|
|
|
39
40
|
tracemalloc.start(25)
|
|
40
41
|
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
|
@@ -171,8 +172,18 @@ class TestNetworkManager(dbusmock.DBusTestCase):
|
|
|
171
172
|
self.assertRegex(res.stderr, b"No network.*nonexisting")
|
|
172
173
|
self.assertRegex(self.read_device(), r"wlan0.*\sconnected\s+--")
|
|
173
174
|
|
|
175
|
+
# TODO: for connecting to password protected Wifi we need to implement secrets agent
|
|
176
|
+
# https://github.com/martinpitt/python-dbusmock/issues/216
|
|
177
|
+
out = subprocess.check_output(["nmcli", "--version"], universal_newlines=True)
|
|
178
|
+
m = re.search(r"([1-9.]+[0-9])", out)
|
|
179
|
+
assert m, "could not parse version from " + out
|
|
180
|
+
if Version(m.group(1)) >= Version("1.49.3"):
|
|
181
|
+
self.skipTest("https://github.com/martinpitt/python-dbusmock/issues/216")
|
|
182
|
+
|
|
174
183
|
# connect to existing wifi with password
|
|
175
|
-
subprocess.check_call(
|
|
184
|
+
subprocess.check_call(
|
|
185
|
+
["timeout", "--signal=KILL", "5", "nmcli", "dev", "wifi", "connect", "AP_3", "password", "s3kr1t"]
|
|
186
|
+
)
|
|
176
187
|
self.assertRegex(self.read_device(), r"wlan0.*\sconnected\s+AP_3")
|
|
177
188
|
|
|
178
189
|
# connect to existing wifi without password
|
|
@@ -352,7 +363,7 @@ class TestNetworkManager(dbusmock.DBusTestCase):
|
|
|
352
363
|
|
|
353
364
|
# Use the same settings, but this one will autoconnect.
|
|
354
365
|
uuid2 = "22222222-2222-2222-2222-222222222222"
|
|
355
|
-
settings["connection"]["autoconnect"] = dbus.Boolean(True
|
|
366
|
+
settings["connection"]["autoconnect"] = dbus.Boolean(True)
|
|
356
367
|
settings["connection"]["uuid"] = uuid2
|
|
357
368
|
|
|
358
369
|
con2 = self.settings.AddConnection(settings)
|
|
@@ -92,7 +92,7 @@ class TestUPower(dbusmock.DBusTestCase):
|
|
|
92
92
|
|
|
93
93
|
with subprocess.Popen(["upower", "--monitor-detail"], stdout=subprocess.PIPE, universal_newlines=True) as mon:
|
|
94
94
|
time.sleep(0.3)
|
|
95
|
-
self.dbusmock.SetDeviceProperties(path, {"PowerSupply": dbus.Boolean(True
|
|
95
|
+
self.dbusmock.SetDeviceProperties(path, {"PowerSupply": dbus.Boolean(True)})
|
|
96
96
|
time.sleep(0.2)
|
|
97
97
|
|
|
98
98
|
mon.terminate()
|
|
@@ -51,7 +51,7 @@ class TestURfkill(dbusmock.DBusTestCase):
|
|
|
51
51
|
def test_mainobject(self):
|
|
52
52
|
(remote_object, iface) = _get_urfkill_objects()
|
|
53
53
|
self.assertFalse(iface.IsFlightMode())
|
|
54
|
-
propiface = dbus.Interface(remote_object,
|
|
54
|
+
propiface = dbus.Interface(remote_object, dbus.PROPERTIES_IFACE)
|
|
55
55
|
version = propiface.Get("org.freedesktop.URfkill", "DaemonVersion")
|
|
56
56
|
self.assertEqual(version, "0.6.0")
|
|
57
57
|
|
|
@@ -61,7 +61,7 @@ class TestURfkill(dbusmock.DBusTestCase):
|
|
|
61
61
|
for i in individual_objects:
|
|
62
62
|
path = "/org/freedesktop/URfkill/" + i
|
|
63
63
|
remote_object = bus.get_object("org.freedesktop.URfkill", path)
|
|
64
|
-
propiface = dbus.Interface(remote_object,
|
|
64
|
+
propiface = dbus.Interface(remote_object, dbus.PROPERTIES_IFACE)
|
|
65
65
|
state = propiface.Get("org.freedesktop.URfkill.Killswitch", "state")
|
|
66
66
|
self.assertEqual(state, 0)
|
|
67
67
|
|
|
@@ -70,7 +70,7 @@ class TestURfkill(dbusmock.DBusTestCase):
|
|
|
70
70
|
(_, iface) = _get_urfkill_objects()
|
|
71
71
|
|
|
72
72
|
property_object = bus.get_object("org.freedesktop.URfkill", "/org/freedesktop/URfkill/WLAN")
|
|
73
|
-
propiface = dbus.Interface(property_object,
|
|
73
|
+
propiface = dbus.Interface(property_object, dbus.PROPERTIES_IFACE)
|
|
74
74
|
self.assertEqual(propiface.Get("org.freedesktop.URfkill.Killswitch", "state"), 0)
|
|
75
75
|
|
|
76
76
|
self.assertTrue(iface.Block(1, True))
|
|
@@ -87,7 +87,7 @@ class TestURfkill(dbusmock.DBusTestCase):
|
|
|
87
87
|
(_, iface) = _get_urfkill_objects()
|
|
88
88
|
|
|
89
89
|
property_object = bus.get_object("org.freedesktop.URfkill", "/org/freedesktop/URfkill/WLAN")
|
|
90
|
-
propiface = dbus.Interface(property_object,
|
|
90
|
+
propiface = dbus.Interface(property_object, dbus.PROPERTIES_IFACE)
|
|
91
91
|
|
|
92
92
|
self.assertFalse(iface.IsFlightMode())
|
|
93
93
|
self.assertEqual(propiface.Get("org.freedesktop.URfkill.Killswitch", "state"), 0)
|
|
@@ -104,7 +104,7 @@ class TestURfkill(dbusmock.DBusTestCase):
|
|
|
104
104
|
(_, iface) = _get_urfkill_objects()
|
|
105
105
|
|
|
106
106
|
property_object = bus.get_object("org.freedesktop.URfkill", "/org/freedesktop/URfkill/WLAN")
|
|
107
|
-
propiface = dbus.Interface(property_object,
|
|
107
|
+
propiface = dbus.Interface(property_object, dbus.PROPERTIES_IFACE)
|
|
108
108
|
|
|
109
109
|
self.assertFalse(iface.IsFlightMode())
|
|
110
110
|
self.assertEqual(propiface.Get("org.freedesktop.URfkill.Killswitch", "state"), 0)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/power_profiles_daemon.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/dbusmock/templates/upower_power_profiles_daemon.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python-dbusmock-0.32.1 → python-dbusmock-0.32.2}/python_dbusmock.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|