;; 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")