test(GODT-1602): run integration tests against black 🖤

This commit is contained in:
Jakub Cuth
2024-02-19 10:43:35 +00:00
parent 2a1aeb208d
commit 37352d44d2
51 changed files with 525 additions and 271 deletions

View File

@ -26,14 +26,20 @@ import (
"github.com/ProtonMail/gluon/async"
"github.com/ProtonMail/go-proton-api"
"github.com/ProtonMail/gopenpgp/v2/crypto"
"github.com/ProtonMail/proton-bridge/v3/internal/dialer"
"github.com/bradenaw/juniper/stream"
)
// withProton executes the given function with a proton manager configured to use the test API.
func (t *testCtx) withProton(fn func(*proton.Manager) error) error {
tr := proton.InsecureTransport()
if isBlack() {
dialer.SetBasicTransportTimeouts(tr)
}
m := proton.New(
proton.WithHostURL(t.api.GetHostURL()),
proton.WithTransport(proton.InsecureTransport()),
proton.WithTransport(tr),
proton.WithAppVersion(t.api.GetAppVersion()),
proton.WithDebug(os.Getenv("FEATURE_API_DEBUG") != ""),
)
@ -88,6 +94,15 @@ func (t *testCtx) runQuarkCmd(ctx context.Context, command string, args ...strin
return out, nil
}
func (t *testCtx) decryptID(id string) ([]byte, error) {
return t.runQuarkCmd(context.Background(),
"encryption:id",
"--decrypt",
"--",
id,
)
}
func (t *testCtx) withAddrKR(
ctx context.Context,
c *proton.Client,