summaryrefslogtreecommitdiff
path: root/test/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/net/dbus-tests.el82
1 files changed, 82 insertions, 0 deletions
diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el
index 2186d454aee..3bb2264defb 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")