diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-10-07 19:01:18 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-10-07 19:03:51 +0900 |
| commit | d23b4dc9e64d3f00e746c65f3038a1a6de44b8f5 (patch) | |
| tree | 46e7f73bc2b06047561588294759ddb8a71184f2 /system/dbus_test.go | |
| parent | 3ce63e95d7691450f7b368e639d984a223a764b1 (diff) | |
hst/dbus: move dbus config struct
This allows holding a xdg-dbus-proxy configuration without importing system/dbus.
It also makes more sense in the project structure since the config struct is part of the hst API however the rest of the implementation is not.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system/dbus_test.go')
| -rw-r--r-- | system/dbus_test.go | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/system/dbus_test.go b/system/dbus_test.go index 0f3033a4..0bc7b7fd 100644 --- a/system/dbus_test.go +++ b/system/dbus_test.go @@ -11,6 +11,7 @@ import ( "hakurei.app/container/stub" "hakurei.app/helper" + "hakurei.app/hst" "hakurei.app/system/dbus" ) @@ -82,7 +83,7 @@ func TestDBusProxyOp(t *testing.T) { Op: "dbus", Err: ErrDBusConfig, Msg: "attempted to create message bus proxy args without session bus config", } - if err := sys.ProxyDBus(nil, new(dbus.Config), nil, nil); !reflect.DeepEqual(err, wantErr) { + if err := sys.ProxyDBus(nil, new(hst.BusConfig), nil, nil); !reflect.DeepEqual(err, wantErr) { t.Errorf("ProxyDBus: error = %v, want %v", err, wantErr) } }, nil, stub.Expect{}}, @@ -96,10 +97,10 @@ func TestDBusProxyOp(t *testing.T) { }() sys.MustProxyDBus( - m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"), &dbus.Config{ + m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"), &hst.BusConfig{ // use impossible value here as an implicit assert that it goes through the stub Talk: []string{"session\x00"}, Filter: true, - }, m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"), &dbus.Config{ + }, m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"), &hst.BusConfig{ // use impossible value here as an implicit assert that it goes through the stub Talk: []string{"system\x00"}, Filter: true, }) @@ -108,8 +109,8 @@ func TestDBusProxyOp(t *testing.T) { call("dbusFinalise", stub.ExpectArgs{ dbus.ProxyPair{"unix:path=/run/user/1000/bus", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"}, dbus.ProxyPair{"unix:path=/run/dbus/system_bus_socket", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"}, - &dbus.Config{Talk: []string{"session\x00"}, Filter: true}, - &dbus.Config{Talk: []string{"system\x00"}, Filter: true}, + &hst.BusConfig{Talk: []string{"session\x00"}, Filter: true}, + &hst.BusConfig{Talk: []string{"system\x00"}, Filter: true}, }, (*dbus.Final)(nil), syscall.EINVAL), }}}, @@ -119,10 +120,10 @@ func TestDBusProxyOp(t *testing.T) { Msg: "cannot finalise message bus proxy: unique error 0 injected by the test suite", } if err := sys.ProxyDBus( - &dbus.Config{ + &hst.BusConfig{ // use impossible value here as an implicit assert that it goes through the stub Talk: []string{"session\x00"}, Filter: true, - }, &dbus.Config{ + }, &hst.BusConfig{ // use impossible value here as an implicit assert that it goes through the stub Talk: []string{"system\x00"}, Filter: true, }, @@ -135,17 +136,17 @@ func TestDBusProxyOp(t *testing.T) { call("dbusFinalise", stub.ExpectArgs{ dbus.ProxyPair{"unix:path=/run/user/1000/bus", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"}, dbus.ProxyPair{"unix:path=/run/dbus/system_bus_socket", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"}, - &dbus.Config{Talk: []string{"session\x00"}, Filter: true}, - &dbus.Config{Talk: []string{"system\x00"}, Filter: true}, + &hst.BusConfig{Talk: []string{"session\x00"}, Filter: true}, + &hst.BusConfig{Talk: []string{"system\x00"}, Filter: true}, }, (*dbus.Final)(nil), stub.UniqueError(0)), }}}, {"full", 0xcafebabe, func(_ *testing.T, sys *I) { sys.MustProxyDBus( - m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"), &dbus.Config{ + m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"), &hst.BusConfig{ // use impossible value here as an implicit assert that it goes through the stub Talk: []string{"session\x00"}, Filter: true, - }, m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"), &dbus.Config{ + }, m("/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"), &hst.BusConfig{ // use impossible value here as an implicit assert that it goes through the stub Talk: []string{"system\x00"}, Filter: true, }) @@ -159,8 +160,8 @@ func TestDBusProxyOp(t *testing.T) { call("dbusFinalise", stub.ExpectArgs{ dbus.ProxyPair{"unix:path=/run/user/1000/bus", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus"}, dbus.ProxyPair{"unix:path=/run/dbus/system_bus_socket", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/system_bus_socket"}, - &dbus.Config{Talk: []string{"session\x00"}, Filter: true}, - &dbus.Config{Talk: []string{"system\x00"}, Filter: true}, + &hst.BusConfig{Talk: []string{"session\x00"}, Filter: true}, + &hst.BusConfig{Talk: []string{"system\x00"}, Filter: true}, }, dbusNewFinalSample(0), nil), call("isVerbose", stub.ExpectArgs{}, true, nil), call("verbose", stub.ExpectArgs{[]any{"session bus proxy:", []string{"unix:path=/run/user/1000/bus", "/tmp/hakurei.0/99dd71ee2146369514e0d10783368f8f/bus", "--filter", "--talk=session\x00"}}}, nil, nil), |
