diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-03-15 23:57:44 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-03-16 00:01:25 +0900 |
| commit | 6e7ddb2d2ec6b163dc2c178bc4d73b5943f51206 (patch) | |
| tree | 37ffe1564782377c1983909362ed6109c3f06b28 /dbus/samples_test.go | |
| parent | bac4e67867faa7d8274b684575140a65827d3a4c (diff) | |
helper: eliminate commandContext replacement
This is done more cleanly by modifying Args in cmdF.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'dbus/samples_test.go')
| -rw-r--r-- | dbus/samples_test.go | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/dbus/samples_test.go b/dbus/samples_test.go index 653a02f4..75ed0225 100644 --- a/dbus/samples_test.go +++ b/dbus/samples_test.go @@ -6,6 +6,12 @@ import ( "git.gensokyo.uk/security/fortify/dbus" ) +const ( + sampleHostPath = "/run/user/1971/bus" + sampleHostAddr = "unix:path=" + sampleHostPath + sampleBindPath = "/tmp/fortify.1971/12622d846cc3fe7b4c10359d01f0eb47/bus" +) + var samples = []dbusTestCase{ { "org.chromium.Chromium", &dbus.Config{ @@ -19,10 +25,10 @@ var samples = []dbusTestCase{ Log: false, Filter: true, }, false, false, - [2]string{"unix:path=/run/user/1971/bus", "/tmp/fortify.1971/12622d846cc3fe7b4c10359d01f0eb47/bus"}, + [2]string{sampleHostAddr, sampleBindPath}, []string{ - "unix:path=/run/user/1971/bus", - "/tmp/fortify.1971/12622d846cc3fe7b4c10359d01f0eb47/bus", + sampleHostAddr, + sampleBindPath, "--filter", "--talk=org.freedesktop.Notifications", "--talk=org.freedesktop.FileManager1", @@ -48,9 +54,10 @@ var samples = []dbusTestCase{ Log: false, Filter: true, }, false, false, - [2]string{"unix:path=/run/dbus/system_bus_socket", "/tmp/fortify.1971/12622d846cc3fe7b4c10359d01f0eb47/system_bus_socket"}, - []string{"unix:path=/run/dbus/system_bus_socket", - "/tmp/fortify.1971/12622d846cc3fe7b4c10359d01f0eb47/system_bus_socket", + [2]string{sampleHostAddr, sampleBindPath}, + []string{ + sampleHostAddr, + sampleBindPath, "--filter", "--talk=org.bluez", "--talk=org.freedesktop.Avahi", @@ -68,10 +75,10 @@ var samples = []dbusTestCase{ Log: false, Filter: true, }, false, false, - [2]string{"unix:path=/run/user/1971/bus", "/tmp/fortify.1971/34c24f16a0d791d28835ededaf446033/bus"}, + [2]string{sampleHostAddr, sampleBindPath}, []string{ - "unix:path=/run/user/1971/bus", - "/tmp/fortify.1971/34c24f16a0d791d28835ededaf446033/bus", + sampleHostAddr, + sampleBindPath, "--filter", "--talk=org.freedesktop.Notifications", "--talk=org.kde.StatusNotifierWatcher", @@ -91,10 +98,10 @@ var samples = []dbusTestCase{ Log: true, Filter: true, }, false, false, - [2]string{"unix:path=/run/user/1971/bus", "/tmp/fortify.1971/5da7845287a936efbc2fa75d7d81e501/bus"}, + [2]string{sampleHostAddr, sampleBindPath}, []string{ - "unix:path=/run/user/1971/bus", - "/tmp/fortify.1971/5da7845287a936efbc2fa75d7d81e501/bus", + sampleHostAddr, + sampleBindPath, "--filter", "--see=uk.gensokyo.CrashTestDummy1", "--talk=org.freedesktop.Notifications", @@ -114,10 +121,10 @@ var samples = []dbusTestCase{ Log: true, Filter: true, }, false, true, - [2]string{"unix:path=/run/user/1971/bus", "/tmp/fortify.1971/5da7845287a936efbc2fa75d7d81e501/bus"}, + [2]string{sampleHostAddr, sampleBindPath}, []string{ - "unix:path=/run/user/1971/bus", - "/tmp/fortify.1971/5da7845287a936efbc2fa75d7d81e501/bus", + sampleHostAddr, + sampleBindPath, "--filter", "--see=uk.gensokyo.CrashTestDummy", "--talk=org.freedesktop.Notifications", |
