diff -Nru python-dbusmock-0.18.3/dbusmock/templates/low_memory_monitor.py python-dbusmock-0.19/dbusmock/templates/low_memory_monitor.py --- python-dbusmock-0.18.3/dbusmock/templates/low_memory_monitor.py 1970-01-01 00:00:00.000000000 +0000 +++ python-dbusmock-0.19/dbusmock/templates/low_memory_monitor.py 2020-01-09 20:21:27.000000000 +0000 @@ -0,0 +1,38 @@ +'''low-memory-monitor mock template + +This creates the expected methods and properties of the main +org.freedesktop.LowMemoryMonitor object. + +This provides only the 2.0 D-Bus API of low-memory-monitor. +''' + +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 3 of the License, or (at your option) any +# later version. See http://www.gnu.org/copyleft/lgpl.html for the full text +# of the license. + +__author__ = 'Bastien Nocera' +__email__ = 'hadess@hadess.net' +__copyright__ = '(c) 2019, Red Hat Inc.' +__license__ = 'LGPL 3+' + +import dbus + +from dbusmock import MOCK_IFACE + +BUS_NAME = 'org.freedesktop.LowMemoryMonitor' +MAIN_OBJ = '/org/freedesktop/LowMemoryMonitor' +MAIN_IFACE = 'org.freedesktop.LowMemoryMonitor' +SYSTEM_BUS = True + + +def load(mock, parameters): + # Loaded! + mock.loaded = True + + +@dbus.service.method(MOCK_IFACE, + in_signature='y', out_signature='') +def EmitWarning(self, state): + self.EmitSignal(MAIN_IFACE, 'LowMemoryWarning', 'y', [dbus.Byte(state)]) diff -Nru python-dbusmock-0.18.3/dbusmock/templates/networkmanager.py python-dbusmock-0.19/dbusmock/templates/networkmanager.py --- python-dbusmock-0.18.3/dbusmock/templates/networkmanager.py 2019-09-08 20:58:52.000000000 +0000 +++ python-dbusmock-0.19/dbusmock/templates/networkmanager.py 2020-01-09 20:21:27.000000000 +0000 @@ -43,7 +43,7 @@ class NMState: '''Global state - As per https://developer.gnome.org/NetworkManager/unstable/spec.html#type-NM_STATE + As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NMState ''' NM_STATE_UNKNOWN = 0 NM_STATE_ASLEEP = 10 @@ -58,7 +58,7 @@ class NMConnectivityState: '''Connectvity state - As per https://developer.gnome.org/NetworkManager/unstable/spec.html#type-NM_CONNECTIVITY + As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NMConnectivityState ''' NM_CONNECTIVITY_UNKNOWN = 0 NM_CONNECTIVITY_NONE = 1 @@ -70,7 +70,7 @@ class NMActiveConnectionState: '''Active connection state - As per https://developer.gnome.org/NetworkManager/unstable/spec.html#type-NM_ACTIVE_CONNECTION_STATE + As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NMActiveConnectionState ''' NM_ACTIVE_CONNECTION_STATE_UNKNOWN = 0 NM_ACTIVE_CONNECTION_STATE_ACTIVATING = 1 @@ -82,7 +82,7 @@ class InfrastructureMode: '''Infrastructure mode - As per https://developer.gnome.org/NetworkManager/unstable/spec.html#type-NM_802_11_MODE + As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NM80211Mode ''' NM_802_11_MODE_UNKNOWN = 0 NM_802_11_MODE_ADHOC = 1 @@ -100,7 +100,7 @@ class DeviceState: '''Device states - As per https://developer.gnome.org/NetworkManager/unstable/spec.html#type-NM_DEVICE_STATE + As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NMDeviceState ''' UNKNOWN = 0 UNMANAGED = 10 @@ -120,7 +120,7 @@ class NM80211ApSecurityFlags: '''Security flags - As per https://developer.gnome.org/NetworkManager/unstable/spec.html#type-NM_802_11_AP_SEC + As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NM80211ApSecurityFlags ''' NM_802_11_AP_SEC_NONE = 0x00000000 NM_802_11_AP_SEC_PAIR_WEP40 = 0x00000001 @@ -145,7 +145,7 @@ class NM80211ApFlags: '''Device flags - As per https://developer.gnome.org/NetworkManager/unstable/spec.html#type-NM_802_11_AP_FLAGS + As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NM80211ApFlags ''' NM_802_11_AP_FLAGS_NONE = 0x00000000 NM_802_11_AP_FLAGS_PRIVACY = 0x00000001 @@ -279,6 +279,7 @@ dev_obj.Set(DEVICE_IFACE, 'ActiveConnection', dbus.ObjectPath(active_connection_path)) old_state = dev_obj.Get(DEVICE_IFACE, 'State') dev_obj.Set(DEVICE_IFACE, 'State', dbus.UInt32(DeviceState.ACTIVATED)) + dev_obj.Set(DEVICE_IFACE, 'StateReason', (dbus.UInt32(DeviceState.ACTIVATED), dbus.UInt32(0))) dev_obj.EmitSignal(DEVICE_IFACE, 'StateChanged', 'uuu', [dbus.UInt32(DeviceState.ACTIVATED), old_state, dbus.UInt32(1)]) @@ -290,6 +291,7 @@ dev_obj.Set(DEVICE_IFACE, 'ActiveConnection', dbus.ObjectPath('/')) old_state = dev_obj.Get(DEVICE_IFACE, 'State') dev_obj.Set(DEVICE_IFACE, 'State', dbus.UInt32(DeviceState.DISCONNECTED)) + dev_obj.Set(DEVICE_IFACE, 'StateReason', (dbus.UInt32(DeviceState.DISCONNECTED), dbus.UInt32(0))) dev_obj.EmitSignal(DEVICE_IFACE, 'StateChanged', 'uuu', [dbus.UInt32(DeviceState.DISCONNECTED), old_state, dbus.UInt32(1)]) @@ -303,7 +305,7 @@ state. You can use the predefined DeviceState values (e. g. DeviceState.ACTIVATED) or supply a numeric value. For valid state values please visit - http://projects.gnome.org/NetworkManager/developers/api/09/spec.html#type-NM_DEVICE_STATE + https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NMDeviceState Please note that this does not set any global properties. @@ -321,6 +323,7 @@ props = {'DeviceType': dbus.UInt32(1), 'State': dbus.UInt32(state), + 'StateReason': (dbus.UInt32(state), dbus.UInt32(0)), 'Interface': iface_name, 'ActiveConnection': dbus.ObjectPath('/'), 'AvailableConnections': dbus.Array([], signature='o'), @@ -352,7 +355,7 @@ state. You can use the predefined DeviceState values (e. g. DeviceState.ACTIVATED) or supply a numeric value. For valid state values, please visit - http://projects.gnome.org/NetworkManager/developers/api/09/spec.html#type-NM_DEVICE_STATE + https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NMDeviceState Please note that this does not set any global properties. @@ -389,6 +392,7 @@ 'Driver': 'dbusmock', 'DeviceType': dbus.UInt32(2), 'State': dbus.UInt32(state), + 'StateReason': (dbus.UInt32(state), dbus.UInt32(0)), 'Interface': iface_name, 'IpInterface': iface_name, }) @@ -413,7 +417,7 @@ You have to specify WiFi Device path, Access Point object name, ssid, hw_address, mode, frequency, rate, strength and security. For valid access point property values, please visit - http://projects.gnome.org/NetworkManager/developers/api/09/spec.html#org.freedesktop.NetworkManager.AccessPoint + https://developer.gnome.org/NetworkManager/unstable/gdbus-org.freedesktop.NetworkManager.AccessPoint.html Please note that this does not set any global properties. @@ -575,6 +579,7 @@ settings = conn_obj.settings conn_uuid = settings['connection']['uuid'] conn_type = settings['connection']['type'] + conn_id = settings['connection']['id'] device_objects = [dbus.ObjectPath(dev) for dev in devices] @@ -592,6 +597,7 @@ 'SpecificObject': dbus.ObjectPath(specific_object), 'Uuid': conn_uuid, 'State': dbus.UInt32(state), + 'Id': conn_id, }, []) @@ -699,8 +705,7 @@ '''Add a connection. connection_settings is a String String Variant Map Map. See - https://developer.gnome.org/NetworkManager/0.9/spec.html - #type-String_String_Variant_Map_Map + https://developer.gnome.org/NetworkManager/0.9/spec.html #type-String_String_Variant_Map_Map If you omit uuid, this method adds one for you. ''' @@ -780,8 +785,7 @@ '''Update settings on a connection. settings is a String String Variant Map Map. See - https://developer.gnome.org/NetworkManager/0.9/spec.html - #type-String_String_Variant_Map_Map + https://developer.gnome.org/NetworkManager/0.9/spec.html#type-String_String_Variant_Map_Map ''' connection_path = self.connection_path diff -Nru python-dbusmock-0.18.3/debian/changelog python-dbusmock-0.19/debian/changelog --- python-dbusmock-0.18.3/debian/changelog 2019-10-31 10:30:11.000000000 +0000 +++ python-dbusmock-0.19/debian/changelog 2020-01-09 20:36:10.000000000 +0000 @@ -1,3 +1,18 @@ +python-dbusmock (0.19-1) unstable; urgency=medium + + [ Ondřej Nový ] + * Use debhelper-compat instead of debian/compat + + [ Martin Pitt ] + * Move packaging VCS to python-team repository. + Update Vcs-* tags accordingly. (Closes: #946098) + * New upstream version 0.19: + - NetworkManager template: Add "StateReason" property and active connection ID + (Closes: #947712) + - Add low-memory-monitor template + + -- Martin Pitt Thu, 09 Jan 2020 20:36:10 +0000 + python-dbusmock (0.18.3-2) unstable; urgency=medium * Drop Python 2 package. diff -Nru python-dbusmock-0.18.3/debian/compat python-dbusmock-0.19/debian/compat --- python-dbusmock-0.18.3/debian/compat 2019-10-31 10:30:11.000000000 +0000 +++ python-dbusmock-0.19/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -10 diff -Nru python-dbusmock-0.18.3/debian/control python-dbusmock-0.19/debian/control --- python-dbusmock-0.18.3/debian/control 2019-10-31 10:30:11.000000000 +0000 +++ python-dbusmock-0.19/debian/control 2020-01-09 20:36:10.000000000 +0000 @@ -1,7 +1,7 @@ Source: python-dbusmock Section: python Priority: optional -Build-Depends: debhelper (>= 10), +Build-Depends: debhelper-compat (= 10), dh-python, python3-all, python3-setuptools @@ -14,8 +14,8 @@ libnotify-bin Maintainer: Debian Python Modules Team Uploaders: Martin Pitt -Vcs-Browser: https://salsa.debian.org/debian/python-dbusmock -Vcs-Git: https://salsa.debian.org/debian/python-dbusmock.git +Vcs-Browser: https://salsa.debian.org/python-team/modules/python-dbusmock +Vcs-Git: https://salsa.debian.org/python-team/modules/python-dbusmock Standards-Version: 4.4.0 Homepage: https://github.com/martinpitt/python-dbusmock/ diff -Nru python-dbusmock-0.18.3/NEWS python-dbusmock-0.19/NEWS --- python-dbusmock-0.18.3/NEWS 2019-09-08 20:58:52.000000000 +0000 +++ python-dbusmock-0.19/NEWS 2020-01-09 20:21:27.000000000 +0000 @@ -1,3 +1,8 @@ +0.19 (2020-01-09) +----------------- +- NetworkManager template: Add "StateReason" property and active connection ID +- Add low-memory-monitor template + 0.18.3 (2019-09-08) ------------------- - Fix timeouts for loaded machines and parallel tests diff -Nru python-dbusmock-0.18.3/PKG-INFO python-dbusmock-0.19/PKG-INFO --- python-dbusmock-0.18.3/PKG-INFO 2019-09-08 21:00:09.000000000 +0000 +++ python-dbusmock-0.19/PKG-INFO 2020-01-09 20:22:37.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: python-dbusmock -Version: 0.18.3 +Version: 0.19 Summary: Mock D-Bus objects Home-page: https://github.com/martinpitt/python-dbusmock Author: Martin Pitt diff -Nru python-dbusmock-0.18.3/python_dbusmock.egg-info/PKG-INFO python-dbusmock-0.19/python_dbusmock.egg-info/PKG-INFO --- python-dbusmock-0.18.3/python_dbusmock.egg-info/PKG-INFO 2019-09-08 21:00:09.000000000 +0000 +++ python-dbusmock-0.19/python_dbusmock.egg-info/PKG-INFO 2020-01-09 20:22:37.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: python-dbusmock -Version: 0.18.3 +Version: 0.19 Summary: Mock D-Bus objects Home-page: https://github.com/martinpitt/python-dbusmock Author: Martin Pitt diff -Nru python-dbusmock-0.18.3/python_dbusmock.egg-info/SOURCES.txt python-dbusmock-0.19/python_dbusmock.egg-info/SOURCES.txt --- python-dbusmock-0.18.3/python_dbusmock.egg-info/SOURCES.txt 2019-09-08 21:00:09.000000000 +0000 +++ python-dbusmock-0.19/python_dbusmock.egg-info/SOURCES.txt 2020-01-09 20:22:37.000000000 +0000 @@ -13,6 +13,7 @@ dbusmock/templates/bluez5.py dbusmock/templates/gnome_screensaver.py dbusmock/templates/logind.py +dbusmock/templates/low_memory_monitor.py dbusmock/templates/networkmanager.py dbusmock/templates/notification_daemon.py dbusmock/templates/ofono.py @@ -32,6 +33,7 @@ tests/test_consolekit.py tests/test_gnome_screensaver.py tests/test_logind.py +tests/test_low_memory_monitor.py tests/test_networkmanager.py tests/test_notification_daemon.py tests/test_ofono.py diff -Nru python-dbusmock-0.18.3/tests/test_low_memory_monitor.py python-dbusmock-0.19/tests/test_low_memory_monitor.py --- python-dbusmock-0.18.3/tests/test_low_memory_monitor.py 1970-01-01 00:00:00.000000000 +0000 +++ python-dbusmock-0.19/tests/test_low_memory_monitor.py 2020-01-09 20:21:27.000000000 +0000 @@ -0,0 +1,61 @@ +#!/usr/bin/python3 + +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 3 of the License, or (at your option) any +# later version. See http://www.gnu.org/copyleft/lgpl.html for the full text +# of the license. + +__author__ = 'Bastien Nocera' +__email__ = 'hadess@hadess.net' +__copyright__ = '(c) 2019 Red Hat Inc.' +__license__ = 'LGPL 3+' + +import unittest +import sys +import subprocess +import dbus +import dbus.mainloop.glib +import dbusmock +import fcntl +import os + +dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) + + +class TestLowMemoryMonitor(dbusmock.DBusTestCase): + '''Test mocking low-memory-monitor''' + + @classmethod + def setUpClass(klass): + klass.start_system_bus() + klass.dbus_con = klass.get_dbus(True) + + def setUp(self): + (self.p_mock, self.obj_lmm) = self.spawn_server_template( + 'low_memory_monitor', {}, stdout=subprocess.PIPE) + # set log to nonblocking + flags = fcntl.fcntl(self.p_mock.stdout, fcntl.F_GETFL) + fcntl.fcntl(self.p_mock.stdout, fcntl.F_SETFL, flags | os.O_NONBLOCK) + self.last_warning = -1 + self.dbusmock = dbus.Interface(self.obj_lmm, dbusmock.MOCK_IFACE) + + def tearDown(self): + self.p_mock.terminate() + self.p_mock.wait() + + def test_low_memory_warning_signal(self): + '''LowMemoryWarning signal''' + + self.dbusmock.EmitWarning(100) + log = self.p_mock.stdout.read() + self.assertRegex(log, b'[0-9.]+ emit .*LowMemoryWarning 100\n') + + self.dbusmock.EmitWarning(255) + log = self.p_mock.stdout.read() + self.assertRegex(log, b'[0-9.]+ emit .*LowMemoryWarning 255\n') + + +if __name__ == '__main__': + # avoid writing to stderr + unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, verbosity=2))