>From 43a446ce12485d669daed978796dc032113d73e5 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Wed, 28 Oct 2020 19:36:19 -0700 Subject: [PATCH] Add tests for D-Bus GetManagedObjects inquiry. * 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 @@ dbus-test08-register-monitor ;; 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") base-commit: bb3d13ac3586d3577605d3d8809d31c62a267c99 -- 2.28.0