test(core): интеграция Settings/Power на session-шине (#[ignore])

Settings round-trip + Changed; Power state + fake-ACC AccChanged — на живой D-Bus.
just test-integration (dbus-run-session). #[ignore] → just ci (unit) не требует шины.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Alexander <akotenev2003@gmail.com>
This commit is contained in:
2026-06-24 12:51:07 +03:00
parent 9aeff2aa7d
commit ce525dd622
7 changed files with 115 additions and 0 deletions
@@ -0,0 +1,44 @@
//! Интеграция `Settings1` на session-шине. `#[ignore]` — запуск: `just test-integration`
//! (под `dbus-run-session`). Проверяет server-стаб + `sdk::SettingsClient` по реальной шине.
use futures_util::StreamExt;
use shturman_common::Layout;
use shturman_sdk::SettingsClient;
use shturman_settings::{store::Store, SettingsService};
use zbus::zvariant::Value;
#[tokio::test]
#[ignore = "нужна session-шина: just test-integration"]
async fn settings_round_trip_and_changed() {
let tmp = tempfile::tempdir().unwrap();
let store = Store::load_or_seed(Layout::new(tmp.path())).unwrap();
// сервер на отдельном соединении (владеет ru.shturman.Settings)
let server = zbus::Connection::session().await.unwrap();
server
.object_server()
.at("/ru/shturman/Settings", SettingsService::new(store))
.await
.unwrap();
server.request_name("ru.shturman.Settings").await.unwrap();
// клиент на отдельном соединении
let client_conn = zbus::Connection::session().await.unwrap();
let client = SettingsClient::new(&client_conn).await.unwrap();
// дефолт засеян
let theme: String = client.get("ui.theme").await.unwrap().try_into().unwrap();
assert_eq!(theme, "auto");
// подписка на Changed до изменения
let mut changed = client.proxy().receive_changed().await.unwrap();
client.set("ui.theme", &Value::from("night")).await.unwrap();
let got: String = client.get("ui.theme").await.unwrap().try_into().unwrap();
assert_eq!(got, "night");
// сигнал Changed пришёл с нужным ключом
let sig = changed.next().await.unwrap();
assert_eq!(sig.args().unwrap().key(), "ui.theme");
}