From 1fb85fb138980ba82a4f99673a020586123b9bc9 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Thu, 29 Oct 2020 12:16:45 +0100 Subject: [PATCH] * 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 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") -- 2.39.2