gui: TestProviderSaveClientCert expects the system's separator (#5928)
On Windows the editor shows a saved certificate path as "~\Downloads\magpie-laptop\client.pem", and the test wanted the "/" form, so it was red on Windows sinceefb75ad1f(11-10). Windows CI only compiles the tests, and023a56373still listed it today. The product is right: provider.CertPath reads "~\" as the home folder, so the shown value saves back to the same file. The test now wants the system's separator and checks that read-back. Run: - win-run (xiaomi-gpu, Windows 11) go test -count=1 -run TestProviderSaveClientCert ./internal/gui: ok (red at main before, "shown true \"~\\Downloads\\magpie-laptop\\client.pem\"", #5928). - mote: go test -count=1 -run 'TestProviderSaveClientCert|TestMTLS' ./internal/gui: ok. gofmt -l clean. Not tried: the rest of the Windows reds in #6068; test-only change, no full suite.
This commit is contained in:
@@ -173,9 +173,14 @@ func TestProviderSaveClientCert(t *testing.T) {
|
||||
t.Fatalf("saved %q %q", p.ClientCert, p.ServerCA)
|
||||
}
|
||||
info := providerInfo(*p, nil)
|
||||
if !info.TakesClientCert || info.ClientCert != "~/Downloads/magpie-laptop/client.pem" {
|
||||
// shown with the system's separator: "~\Downloads\…" on Windows,
|
||||
// which CertPath reads back the same (#5928)
|
||||
if want := "~" + string(filepath.Separator) + filepath.Join("Downloads", "magpie-laptop", "client.pem"); !info.TakesClientCert || info.ClientCert != want {
|
||||
t.Fatalf("shown %v %q", info.TakesClientCert, info.ClientCert)
|
||||
}
|
||||
if back, err := provider.CertPath(info.ClientCert); err != nil || back != p.ClientCert {
|
||||
t.Fatalf("shown %q reads back as %q (%v), saved %q", info.ClientCert, back, err, p.ClientCert)
|
||||
}
|
||||
if code, out := post(base + `,"from":"home","models":[],"headers":{}}`); code != 200 {
|
||||
t.Fatalf("%d %s", code, out)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user