forked from Silverfish/proton-bridge
Other: Fix flaky cookies test
This commit is contained in:
@ -4,8 +4,10 @@ import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"net/http/cookiejar"
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/bridge"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/cookies"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/events"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/useragent"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/vault"
|
||||
@ -36,18 +38,31 @@ func (t *testCtx) startBridge() error {
|
||||
return fmt.Errorf("vault is corrupt")
|
||||
}
|
||||
|
||||
jar, err := cookiejar.New(nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
persister, err := cookies.NewCookieJar(jar, vault)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Create the bridge.
|
||||
bridge, err := bridge.New(
|
||||
t.api.GetHostURL(),
|
||||
t.locator,
|
||||
vault,
|
||||
t.mocks.Autostarter,
|
||||
t.mocks.Updater,
|
||||
t.version,
|
||||
|
||||
t.api.GetHostURL(),
|
||||
persister,
|
||||
useragent.New(),
|
||||
t.mocks.TLSReporter,
|
||||
liteapi.NewDialer(t.netCtl, &tls.Config{InsecureSkipVerify: true}).GetRoundTripper(),
|
||||
t.mocks.ProxyCtl,
|
||||
t.mocks.Autostarter,
|
||||
t.mocks.Updater,
|
||||
t.version,
|
||||
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
|
||||
@ -61,7 +61,7 @@ func (s *scenario) theHeaderInTheRequestToHasSetTo(method, path, key, value stri
|
||||
return err
|
||||
}
|
||||
|
||||
if haveKey := call.Header.Get(key); haveKey != value {
|
||||
if haveKey := call.RequestHeader.Get(key); haveKey != value {
|
||||
return fmt.Errorf("have header %q, want %q", haveKey, value)
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ func (s *scenario) theBodyInTheRequestToIs(method, path string, value *godog.Doc
|
||||
|
||||
var body, want map[string]any
|
||||
|
||||
if err := json.Unmarshal(call.Body, &body); err != nil {
|
||||
if err := json.Unmarshal(call.RequestBody, &body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user