Skip to main content

Module test_support

Module test_support 

Source
Expand description

Test-support helpers for consumer integration tests.

FakePasServer is a wiremock-wrapped fake PAS Authorization Server. It serves the OIDC discovery document, a JWKS containing the public half of an in-process ed25519 keypair, and the token endpoint — exactly enough for super::oidc::RelyingParty::new to bootstrap against and for super::oidc::RelyingParty::start / super::oidc::RelyingParty::complete / super::oidc::RelyingParty::refresh to exercise their HTTP code paths without requiring a real PAS deployment.

Phase 11.Y replaced the 0.7.x RelyingParty::for_test_with_parts test escape hatch with this pattern. Production and test go through the same public interface (RelyingParty::new(config, store)) — only the network destination differs.

§Example

use std::sync::Arc;
use pas_external::oidc::{Config, InMemoryStateStore, RelyingParty, StateStore};
use pas_external::test_support::FakePasServer;
use ppoppo_token::id_token::scopes::Email;

let server = FakePasServer::start().await;
let store: Arc<dyn StateStore> = Arc::new(InMemoryStateStore::new());

let config = Config::new(
    "rp-client-id",
    "https://app.example.com/callback".parse().unwrap(),
    server.issuer_url(),
);

// Real boot path — same as production, just against the fake server.
let rp = RelyingParty::<Email>::new(config, store).await.unwrap();

Structs§

FakePasServer
Wiremock-wrapped fake PAS Authorization Server.
PasIdTokenVerifier
Re-export of the production id_token verifier adapter. PAS OIDC id_token verifier (RFC 9068 + OIDC Core 1.0, EdDSA).
TokenExchangeBody
JSON body for FakePasServer::expect_token_exchange.
TokenResponse
Re-export of the OAuth2 token-endpoint wire DTO (RFC 6749 §5.1 + OIDC Core §3.1.3.3). Token response from PAS token endpoint.