commit
8e48b6875f
@ -0,0 +1 @@
|
||||
SOURCES/python-dbusmock-*.tar.gz
|
@ -0,0 +1 @@
|
||||
ce0d3f64d33c8bf1acf78dff20e72eb6e5561a29 SOURCES/python-dbusmock-0.22.0.tar.gz
|
@ -0,0 +1,189 @@
|
||||
From 9bf4215782517c21ac40e7bfca9e3a43b1b31c5e Mon Sep 17 00:00:00 2001
|
||||
From: Bastien Nocera <hadess@hadess.net>
|
||||
Date: Tue, 16 Feb 2021 14:39:47 +0100
|
||||
Subject: [PATCH 1/3] bluez: Implement Pair() method on the Device interface
|
||||
|
||||
Tested successfully against gnome-bluetooth. Note that pairing does not
|
||||
currently use agents at all, and always succeeds.
|
||||
---
|
||||
dbusmock/templates/bluez5.py | 18 +++++++++++++++++-
|
||||
1 file changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dbusmock/templates/bluez5.py b/dbusmock/templates/bluez5.py
|
||||
index 75e8dcf..5d9676b 100644
|
||||
--- a/dbusmock/templates/bluez5.py
|
||||
+++ b/dbusmock/templates/bluez5.py
|
||||
@@ -18,6 +18,7 @@ This supports BlueZ 5 only.
|
||||
__author__ = 'Philip Withnall'
|
||||
__copyright__ = '(c) 2013 Collabora Ltd.'
|
||||
|
||||
+import os
|
||||
import dbus
|
||||
|
||||
from dbusmock import OBJECT_MANAGER_IFACE, mockobject
|
||||
@@ -123,6 +124,18 @@ def AddAdapter(self, device_name, system_name):
|
||||
return path
|
||||
|
||||
|
||||
+@dbus.service.method(DEVICE_IFACE,
|
||||
+ in_signature='', out_signature='')
|
||||
+def Pair(device):
|
||||
+ if device.paired:
|
||||
+ raise dbus.exceptions.DBusException(
|
||||
+ 'Device already paired',
|
||||
+ name='org.bluez.Error.AlreadyExists')
|
||||
+ device_address = device.props[DEVICE_IFACE]['Address']
|
||||
+ adapter_device_name = os.path.basename(device.props[DEVICE_IFACE]['Adapter'])
|
||||
+ device.PairDevice(adapter_device_name, device_address)
|
||||
+
|
||||
+
|
||||
@dbus.service.method(BLUEZ_MOCK_IFACE,
|
||||
in_signature='sss', out_signature='s')
|
||||
def AddDevice(self, adapter_device_name, device_address, alias):
|
||||
@@ -171,8 +184,10 @@ def AddDevice(self, adapter_device_name, device_address, alias):
|
||||
('ConnectProfile', 's', '', ''),
|
||||
('Disconnect', '', '', ''),
|
||||
('DisconnectProfile', 's', '', ''),
|
||||
- ('Pair', '', '', ''),
|
||||
+ ('Pair', '', '', Pair),
|
||||
])
|
||||
+ device = mockobject.objects[path]
|
||||
+ device.paired = False
|
||||
|
||||
manager = mockobject.objects['/']
|
||||
manager.EmitSignal(OBJECT_MANAGER_IFACE, 'InterfacesAdded',
|
||||
@@ -214,6 +229,7 @@ def PairDevice(_self, adapter_device_name, device_address, class_=5898764):
|
||||
name=BLUEZ_MOCK_IFACE + '.NoSuchDevice')
|
||||
|
||||
device = mockobject.objects[device_path]
|
||||
+ device.paired = True
|
||||
|
||||
# Based off pairing with an Android phone.
|
||||
uuids = [
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
||||
From 2454e9fbfa9d0da3042c51d1a3241b9940a6f1c0 Mon Sep 17 00:00:00 2001
|
||||
From: Bastien Nocera <hadess@hadess.net>
|
||||
Date: Wed, 17 Feb 2021 16:11:17 +0100
|
||||
Subject: [PATCH 2/3] tests: Fix bluez server never being closed down
|
||||
|
||||
The same variable was used to store the obex server's process
|
||||
information so it was closed, and the bluez server's information was
|
||||
lost.
|
||||
---
|
||||
tests/test_bluez5.py | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/test_bluez5.py b/tests/test_bluez5.py
|
||||
index b40950f..cbbc0f7 100644
|
||||
--- a/tests/test_bluez5.py
|
||||
+++ b/tests/test_bluez5.py
|
||||
@@ -205,7 +205,7 @@ class TestBlueZObex(dbusmock.DBusTestCase):
|
||||
self.dbusmock_bluez = dbus.Interface(self.obj_bluez, 'org.bluez.Mock')
|
||||
|
||||
# obexd
|
||||
- (self.p_mock, self.obj_obex) = self.spawn_server_template(
|
||||
+ (self.p_mock_obex, self.obj_obex) = self.spawn_server_template(
|
||||
'bluez5-obex', {}, stdout=subprocess.PIPE)
|
||||
self.dbusmock = dbus.Interface(self.obj_obex, dbusmock.MOCK_IFACE)
|
||||
self.dbusmock_obex = dbus.Interface(self.obj_obex,
|
||||
@@ -216,6 +216,10 @@ class TestBlueZObex(dbusmock.DBusTestCase):
|
||||
self.p_mock.terminate()
|
||||
self.p_mock.wait()
|
||||
|
||||
+ self.p_mock_obex.stdout.close()
|
||||
+ self.p_mock_obex.terminate()
|
||||
+ self.p_mock_obex.wait()
|
||||
+
|
||||
def test_everything(self):
|
||||
# Set up an adapter and device.
|
||||
adapter_name = 'hci0'
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
||||
From 49f493784cf288c95bb90870c8e3a603c64865d3 Mon Sep 17 00:00:00 2001
|
||||
From: Bastien Nocera <hadess@hadess.net>
|
||||
Date: Wed, 17 Feb 2021 16:10:08 +0100
|
||||
Subject: [PATCH 3/3] bluez: Implement the AgentManager1 interface methods
|
||||
|
||||
The pairing agent still doesn't call into those, but this is good enough
|
||||
to register and unregister a pairing agent in gnome-bluetooth's test
|
||||
suite.
|
||||
---
|
||||
dbusmock/templates/bluez5.py | 55 ++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 52 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dbusmock/templates/bluez5.py b/dbusmock/templates/bluez5.py
|
||||
index 5d9676b..6a2f85a 100644
|
||||
--- a/dbusmock/templates/bluez5.py
|
||||
+++ b/dbusmock/templates/bluez5.py
|
||||
@@ -37,11 +37,60 @@ NETWORK_SERVER_IFACE = 'org.bluez.Network1'
|
||||
DEVICE_IFACE = 'org.bluez.Device1'
|
||||
|
||||
|
||||
+@dbus.service.method(AGENT_MANAGER_IFACE,
|
||||
+ in_signature='os', out_signature='')
|
||||
+def RegisterAgent(manager, agent_path, capability):
|
||||
+ all_caps = ['DisplayOnly', 'DisplayYesNo', 'KeyboardOnly',
|
||||
+ 'NoInputNoOutput', 'KeyboardDisplay']
|
||||
+
|
||||
+ if agent_path in manager.agent_paths:
|
||||
+ raise dbus.exceptions.DBusException(
|
||||
+ 'Another agent is already registered ' + manager.agent_path,
|
||||
+ name='org.bluez.Error.AlreadyExists')
|
||||
+
|
||||
+ if capability not in all_caps:
|
||||
+ raise dbus.exceptions.DBusException(
|
||||
+ 'Unsupported capability ' + capability,
|
||||
+ name='org.bluez.Error.InvalidArguments')
|
||||
+
|
||||
+ if not manager.default_agent:
|
||||
+ manager.default_agent = agent_path
|
||||
+ manager.agent_paths += [agent_path]
|
||||
+ manager.capabilities[agent_path] = capability
|
||||
+
|
||||
+
|
||||
+@dbus.service.method(AGENT_MANAGER_IFACE,
|
||||
+ in_signature='o', out_signature='')
|
||||
+def UnregisterAgent(manager, agent_path):
|
||||
+ if agent_path not in manager.agent_paths:
|
||||
+ raise dbus.exceptions.DBusException(
|
||||
+ 'Agent not registered ' + agent_path,
|
||||
+ name='org.bluez.Error.DoesNotExist')
|
||||
+
|
||||
+ manager.agent_paths.remove(agent_path)
|
||||
+ del manager.capabilities[agent_path]
|
||||
+ if manager.default_agent == agent_path:
|
||||
+ if len(manager.agent_paths) > 0:
|
||||
+ manager.default_agent = manager.agent_paths[-1]
|
||||
+ else:
|
||||
+ manager.default_agent = None
|
||||
+
|
||||
+
|
||||
+@dbus.service.method(AGENT_MANAGER_IFACE,
|
||||
+ in_signature='o', out_signature='')
|
||||
+def RequestDefaultAgent(manager, agent_path):
|
||||
+ if agent_path not in manager.agent_paths:
|
||||
+ raise dbus.exceptions.DBusException(
|
||||
+ 'Agent not registered ' + agent_path,
|
||||
+ name='org.bluez.Error.DoesNotExist')
|
||||
+ manager.default_agent = agent_path
|
||||
+
|
||||
+
|
||||
def load(mock, _parameters):
|
||||
mock.AddObject('/org/bluez', AGENT_MANAGER_IFACE, {}, [
|
||||
- ('RegisterAgent', 'os', '', ''),
|
||||
- ('RequestDefaultAgent', 'o', '', ''),
|
||||
- ('UnregisterAgent', 'o', '', ''),
|
||||
+ ('RegisterAgent', 'os', '', RegisterAgent),
|
||||
+ ('RequestDefaultAgent', 'o', '', RequestDefaultAgent),
|
||||
+ ('UnregisterAgent', 'o', '', UnregisterAgent),
|
||||
])
|
||||
|
||||
bluez = mockobject.objects['/org/bluez']
|
||||
--
|
||||
2.30.2
|
||||
|
@ -0,0 +1,220 @@
|
||||
%global modname dbusmock
|
||||
|
||||
Name: python-%{modname}
|
||||
Version: 0.22.0
|
||||
Release: 5%{?dist}
|
||||
Summary: Mock D-Bus objects
|
||||
|
||||
License: LGPLv3+
|
||||
URL: https://pypi.python.org/pypi/python-dbusmock
|
||||
Source0: https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: git
|
||||
BuildRequires: python3-dbus
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-setuptools
|
||||
BuildRequires: python3-gobject
|
||||
BuildRequires: dbus-x11
|
||||
BuildRequires: upower
|
||||
|
||||
# https://github.com/martinpitt/python-dbusmock/pull/66
|
||||
Patch0: bluez-agent-template.patch
|
||||
|
||||
%global _description\
|
||||
With this program/Python library you can easily create mock objects on\
|
||||
D-Bus. This is useful for writing tests for software which talks to\
|
||||
D-Bus services such as upower, systemd, ConsoleKit, gnome-session or\
|
||||
others, and it is hard (or impossible without root privileges) to set\
|
||||
the state of the real services to what you expect in your tests.
|
||||
|
||||
%description %_description
|
||||
|
||||
%package -n python3-dbusmock
|
||||
Summary: %summary (Python3)
|
||||
Requires: python3-dbus, python3-gobject, dbus-x11
|
||||
%description -n python3-dbusmock %_description
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{version} -S git
|
||||
rm -rf python-%{modname}.egg-info
|
||||
|
||||
|
||||
%build
|
||||
%py3_build
|
||||
|
||||
%install
|
||||
%py3_install
|
||||
|
||||
%check
|
||||
%{__python3} -m unittest -v
|
||||
|
||||
%files -n python3-dbusmock
|
||||
%doc README.rst COPYING
|
||||
%{python3_sitelib}/*%{modname}*
|
||||
|
||||
%changelog
|
||||
* Wed May 31 2023 Eugene Zamriy <ezamriy@msvsphere.ru> - 0.22.0-5
|
||||
- Initial build for MSVSphere 9.2
|
||||
|
||||
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 0.22.0-5
|
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||
Related: rhbz#1991688
|
||||
|
||||
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.22.0-4
|
||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||
|
||||
* Mon Mar 22 2021 Bastien Nocera <bnocera@redhat.com> - 0.22.0-3
|
||||
+ python-dbusmock-0.22.0-3
|
||||
- Add bluez agent templates for the benefit of gnome-bluetooth
|
||||
|
||||
* Mon Mar 01 2021 Charalampos Stratakis <cstratak@redhat.com> - 0.22.0-2
|
||||
- Remove redundant dependency on python3-nose
|
||||
|
||||
* Fri Feb 12 2021 Bastien Nocera <bnocera@redhat.com> - 0.22.0-1
|
||||
+ python-dbusmock-0.22.0-1
|
||||
- Update to 0.22.0
|
||||
- Disable tests
|
||||
|
||||
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.18.3-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.18.3-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.18.3-4
|
||||
- Rebuilt for Python 3.9
|
||||
|
||||
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.18.3-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Fri Nov 15 2019 Bastien Nocera <bnocera@redhat.com> - 0.18.3-2
|
||||
+ python-dbusmock-0.18.3-2
|
||||
- Add low-memory-monitor mock
|
||||
|
||||
* Thu Nov 14 2019 Bastien Nocera <bnocera@redhat.com> - 0.18.3-1
|
||||
+ python-dbusmock-0.18.3-1
|
||||
- Update to 0.18.3
|
||||
- Enable tests
|
||||
|
||||
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 0.17-11
|
||||
- Rebuilt for Python 3.8.0rc1 (#1748018)
|
||||
|
||||
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.17-10
|
||||
- Rebuilt for Python 3.8
|
||||
|
||||
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.17-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Tue Jul 23 2019 Miro Hrončok <mhroncok@redhat.com> - 0.17-8
|
||||
- Subpackage python2-dbusmock has been removed
|
||||
See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
|
||||
|
||||
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.17-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.17-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.17-5
|
||||
- Rebuilt for Python 3.7
|
||||
|
||||
* Fri Mar 30 2018 Bastien Nocera <bnocera@redhat.com> - 0.17-4
|
||||
+ python-dbusmock-0.17-4
|
||||
- Patch from Benjamin Berg to correct the python3 subpackage deps
|
||||
and summary
|
||||
|
||||
* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.17-3
|
||||
- Update Python 2 dependency declarations to new packaging standards
|
||||
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
|
||||
|
||||
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.17-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Fri Jan 19 2018 Bastien Nocera <bnocera@redhat.com> - 0.17-1
|
||||
- Update to 0.17
|
||||
- Update source URL
|
||||
|
||||
* Tue Oct 17 2017 Bastien Nocera <bnocera@redhat.com> - 0.16.9-1
|
||||
+ python--0.16.9-1
|
||||
- Update to 0.16.9
|
||||
|
||||
* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.16.7-4
|
||||
- Python 2 binary package renamed to python2-dbusmock
|
||||
See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
|
||||
|
||||
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.7-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.7-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||
|
||||
* Tue Jan 17 2017 Bastien Nocera <bnocera@redhat.com> - 0.16.7-1
|
||||
+ python-dbusmock-0.16.7-1
|
||||
- Update to 0.16.7
|
||||
|
||||
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.11.1-6
|
||||
- Rebuild for Python 3.6
|
||||
|
||||
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.11.1-5
|
||||
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
|
||||
|
||||
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.11.1-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||
|
||||
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.11.1-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
|
||||
|
||||
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.11.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||
|
||||
* Fri Aug 08 2014 Matěj Cepl <mcepl@redhat.com> - 0.11.1-1
|
||||
- Update to 0.11.1
|
||||
|
||||
* Thu Jul 17 2014 Bastien Nocera <bnocera@redhat.com> 0.10.3-2
|
||||
- Add Python3 sub-package
|
||||
|
||||
* Thu Jul 17 2014 Bastien Nocera <bnocera@redhat.com> 0.10.3-1
|
||||
- Update to 0.10.3
|
||||
|
||||
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||
|
||||
* Tue Nov 12 2013 Bastien Nocera <bnocera@redhat.com> 0.8.1-1
|
||||
- Update to 0.8.1
|
||||
|
||||
* Fri Nov 08 2013 Bastien Nocera <bnocera@redhat.com> 0.8-1
|
||||
- Update to 0.8
|
||||
|
||||
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||
|
||||
* Thu Jun 13 2013 Bastien Nocera <bnocera@redhat.com> 0.6.3-1
|
||||
- Update to 0.6.3
|
||||
|
||||
* Thu Jun 13 2013 Bastien Nocera <bnocera@redhat.com> 0.6.2-1
|
||||
- Update to 0.6.2
|
||||
|
||||
* Wed Jun 12 2013 Bastien Nocera <bnocera@redhat.com> 0.6-1
|
||||
- Update to 0.6.0
|
||||
|
||||
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.0-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
||||
|
||||
* Mon Jan 21 2013 Bastien Nocera <bnocera@redhat.com> 0.4.0-1
|
||||
- Update to 0.4.0
|
||||
|
||||
* Mon Jan 07 2013 Bastien Nocera <bnocera@redhat.com> 0.3.1-1
|
||||
- Update to 0.3.1
|
||||
|
||||
* Wed Dec 19 2012 Matěj Cepl <mcepl@redhat.com> - 0.3-1
|
||||
- New upstream release.
|
||||
|
||||
* Mon Oct 08 2012 Matěj Cepl <mcepl@redhat.com> - 0.1.1-2
|
||||
- remove the bundled egg-info following the package review.
|
||||
|
||||
* Fri Oct 05 2012 Matěj Cepl <mcepl@redhat.com> - 0.1.1-1
|
||||
- This version should actually work
|
||||
|
||||
* Tue Oct 02 2012 Matěj Cepl <mcepl@redhat.com> 0.0.3-1
|
||||
- initial package for Fedora
|
Loading…
Reference in new issue