(t *testing.T)
| 41 | ) |
| 42 | |
| 43 | func TestDefaultRuntimeSnapshotsKeyringOptions(t *testing.T) { |
| 44 | t.Setenv("GOG_KEYRING_BACKEND", "file") |
| 45 | t.Setenv("GOG_KEYRING_PASSWORD", "") |
| 46 | t.Setenv("GOG_KEYRING_SERVICE_NAME", "snapshot") |
| 47 | t.Setenv("GOG_KEYRING_LOCK_TIMEOUT", "250ms") |
| 48 | t.Setenv("DBUS_SESSION_BUS_ADDRESS", "unix:path=/snapshot") |
| 49 | |
| 50 | runtime := newDefaultRuntime() |
| 51 | t.Setenv("GOG_KEYRING_BACKEND", "keychain") |
| 52 | t.Setenv("GOG_KEYRING_SERVICE_NAME", "changed") |
| 53 | |
| 54 | options := runtime.KeyringOptions |
| 55 | if options == nil { |
| 56 | t.Fatal("expected keyring options") |
| 57 | } |
| 58 | if options.Backend != "file" || options.ServiceName != "snapshot" { |
| 59 | t.Fatalf("options = %#v", options) |
| 60 | } |
| 61 | if options.Password != "" || !options.PasswordSet { |
| 62 | t.Fatalf("empty password presence was not captured: %#v", options) |
| 63 | } |
| 64 | if options.GOOS != goruntime.GOOS || options.DBusAddress != "unix:path=/snapshot" { |
| 65 | t.Fatalf("platform options = %#v", options) |
| 66 | } |
| 67 | if options.LockTimeout != 250*time.Millisecond { |
| 68 | t.Fatalf("lock timeout = %v", options.LockTimeout) |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | func TestNormalizedRuntimeRequiresKeyringOptions(t *testing.T) { |
| 73 | t.Parallel() |
nothing calls this directly
no test coverage detected