Add trust center OAuth connect e2e coverage

Extend test helpers for portal OAuth flows and cover connect,
callback, and NDA signing against the compliance portal API.

Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-07-15 10:59:43 +02:00
parent 27e012e47a
commit de203325d2
5 changed files with 393 additions and 54 deletions

View File

@@ -21,6 +21,7 @@
package trust_test
import (
"net/url"
"testing"
"github.com/stretchr/testify/require"
@@ -58,6 +59,42 @@ func lookupTrustCenterID(t *testing.T, owner *testutil.Client) string {
return result.Node.TrustCenter.ID
}
func lookupTrustHost(t *testing.T, owner *testutil.Client, trustCenterID string) string {
t.Helper()
activateTrustCenter(t, owner, trustCenterID)
const query = `
query($organizationId: ID!) {
node(id: $organizationId) {
... on Organization {
trustCenter { publicUrl }
}
}
}
`
var result struct {
Node struct {
TrustCenter struct {
PublicURL string `json:"publicUrl"`
} `json:"trustCenter"`
} `json:"node"`
}
err := owner.Execute(query, map[string]any{
"organizationId": owner.GetOrganizationID().String(),
}, &result)
require.NoError(t, err)
require.NotEmpty(t, result.Node.TrustCenter.PublicURL)
publicURL, err := url.Parse(result.Node.TrustCenter.PublicURL)
require.NoError(t, err)
require.NotEmpty(t, publicURL.Host)
return publicURL.Host
}
// activateTrustCenter flips the trust center to active so its public surface
// (NDA, subprocessors, reports, branding) becomes reachable by visitors.
func activateTrustCenter(t *testing.T, owner *testutil.Client, trustCenterID string) {