You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.4 KiB
65 lines
2.4 KiB
From 14c059135e305f85a579acd449f3a1c893558e55 Mon Sep 17 00:00:00 2001
|
|
From: Vendula Poncova <vponcova@redhat.com>
|
|
Date: Thu, 16 Jul 2020 21:28:18 +0200
|
|
Subject: [PATCH 1/2] Fix tests for handling DBus errors on the server side
|
|
|
|
Really check the name and the message of every returned DBus error.
|
|
---
|
|
tests/test_server.py | 19 ++++++++++++-------
|
|
1 file changed, 12 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/tests/test_server.py b/tests/test_server.py
|
|
index d96144e..ce91b97 100644
|
|
--- a/tests/test_server.py
|
|
+++ b/tests/test_server.py
|
|
@@ -94,7 +94,10 @@ class DBusServerTestCase(unittest.TestCase):
|
|
parameters
|
|
)
|
|
|
|
- invocation.return_dbus_error(error_name, error_message)
|
|
+ invocation.return_dbus_error.assert_called_once_with(
|
|
+ error_name,
|
|
+ error_message
|
|
+ )
|
|
invocation.return_value.assert_not_called()
|
|
|
|
def test_register(self):
|
|
@@ -171,8 +174,8 @@ class DBusServerTestCase(unittest.TestCase):
|
|
"Interface",
|
|
"MethodInvalid",
|
|
error_name="not.known.Error.DBusSpecificationError",
|
|
- error_message="Unknown member MethodInvalid of "
|
|
- "the interface Interface."
|
|
+ error_message="DBus specification has no member "
|
|
+ "'Interface.MethodInvalid'."
|
|
)
|
|
|
|
self.error_mapper.add_rule(ErrorRule(
|
|
@@ -238,8 +241,9 @@ class DBusServerTestCase(unittest.TestCase):
|
|
"Property2",
|
|
get_variant("s", "World")
|
|
)),
|
|
- error_name="not.known.AttributeError",
|
|
- error_message="Property2 of Interface is not writable."
|
|
+ error_name="not.known.Error.AttributeError",
|
|
+ error_message="The property Interface.Property2 "
|
|
+ "is not writable."
|
|
)
|
|
self.assertEqual(self.object.Property2, "Hello")
|
|
|
|
@@ -250,8 +254,9 @@ class DBusServerTestCase(unittest.TestCase):
|
|
"Interface",
|
|
"Property3"
|
|
)),
|
|
- error_name="not.known.AttributeError",
|
|
- error_message="Property3 of Interface is not readable."
|
|
+ error_name="not.known.Error.AttributeError",
|
|
+ error_message="The property Interface.Property3 "
|
|
+ "is not readable."
|
|
)
|
|
self._call_method(
|
|
"org.freedesktop.DBus.Properties", "Set",
|
|
--
|
|
2.26.2
|
|
|