[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 1fb85fb 1/3: * test/lisp/net/dbus-tests.el (dbus-test09-get-manag
From: |
Michael Albinus |
Subject: |
master 1fb85fb 1/3: * test/lisp/net/dbus-tests.el (dbus-test09-get-managed-objects): New test. |
Date: |
Thu, 29 Oct 2020 11:56:51 -0400 (EDT) |
branch: master
commit 1fb85fb138980ba82a4f99673a020586123b9bc9
Author: Hugh Daschbach <hdasch@fastmail.com>
Commit: Michael Albinus <michael.albinus@gmx.de>
* test/lisp/net/dbus-tests.el (dbus-test09-get-managed-objects): New test.
---
test/lisp/net/dbus-tests.el | 82 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el
index 2186d45..3bb2264 100644
--- a/test/lisp/net/dbus-tests.el
+++ b/test/lisp/net/dbus-tests.el
@@ -1889,6 +1889,88 @@ The argument EXPECTED-ARGS is a list of expected
arguments for the method."
;; Cleanup.
(dbus-unregister-service :session dbus--test-service)))
+(ert-deftest dbus-test09-get-managed-objects ()
+ "Check `dbus-get-all-managed-objects'."
+ (skip-unless dbus--test-enabled-session-bus)
+ (dbus-ignore-errors (dbus-unregister-service :session dbus--test-service))
+ (dbus-register-service :session dbus--test-service)
+
+ (unwind-protect
+ (let ((path1 (concat dbus--test-path "/path1"))
+ (path2 (concat dbus--test-path "/path2"))
+ (path3 (concat dbus--test-path "/path3")))
+
+ (should-not
+ (dbus-get-all-managed-objects :session dbus--test-service
dbus--test-path))
+
+ (should
+ (equal
+ (dbus-register-property
+ :session dbus--test-service path1 dbus--test-interface
+ "Property1" :readwrite "Simple string one.")
+ `((:property :session ,dbus--test-interface "Property1")
+ (,dbus--test-service ,path1))))
+
+ (should
+ (equal
+ (dbus-get-property
+ :session dbus--test-service path1 dbus--test-interface
+ "Property1")
+ "Simple string one."))
+
+ (should
+ (equal
+ (dbus-register-property
+ :session dbus--test-service path2 dbus--test-interface
+ "Property1" :readwrite "Simple string two.")
+ `((:property :session ,dbus--test-interface "Property1")
+ (,dbus--test-service ,path2))))
+
+ (should
+ (equal
+ (dbus-register-property
+ :session dbus--test-service path3 dbus--test-interface
+ "Property1" :readwrite "Simple string three.")
+ `((:property :session ,dbus--test-interface "Property1")
+ (,dbus--test-service ,path3))))
+
+ (should
+ (equal
+ (dbus-get-property
+ :session dbus--test-service path1 dbus--test-interface
+ "Property1")
+ "Simple string one."))
+
+ (should
+ (equal
+ (dbus-get-property
+ :session dbus--test-service path2 dbus--test-interface
+ "Property1")
+ "Simple string two."))
+
+ (should
+ (equal
+ (dbus-get-property
+ :session dbus--test-service path3 dbus--test-interface
+ "Property1")
+ "Simple string three."))
+
+ (let ((result (dbus-get-all-managed-objects :session
dbus--test-service dbus--test-path)))
+ (should
+ (= 3 (length result)))
+
+ (should
+ (assoc-string path1 result))
+
+ (should
+ (assoc-string path2 result))
+
+ (should
+ (assoc-string path3 result))))
+
+ ;; Cleanup.
+ (dbus-unregister-service :session dbus--test-service)))
+
(defun dbus-test-all (&optional interactive)
"Run all tests for \\[dbus]."
(interactive "p")