@@ -7,6 +7,9 @@ use crate::common::runtime::{origin_port, TestError, TestResult};
77use error_stack:: Report ;
88use error_stack:: ResultExt as _;
99
10+ const INTTEST_API_TOKEN : & str = "integration-test-token-alpha-32-bytes-ok" ;
11+ const INTTEST2_API_TOKEN : & str = "integration-test-token-bravo-32-bytes-ok" ;
12+
1013/// Standard test scenarios applicable to all frontend frameworks.
1114///
1215/// Each scenario tests a core trusted-server behavior that should work
@@ -514,21 +517,21 @@ fn use_seeded_ec(client: &EcTestClient, ec_id: &str) -> String {
514517
515518/// Full lifecycle: seeded EC → batch sync → identify (Bearer auth) with scoped UID.
516519///
517- /// Uses the `inttest` partner pre-configured in `trusted-server.toml` .
520+ /// Uses the `inttest` partner injected by the integration-test build .
518521fn ec_full_lifecycle ( base_url : & str ) -> TestResult < ( ) > {
519522 let client = EcTestClient :: new ( base_url) ;
520523 allow_ec_generation ( & client) ;
521524 let seeded_ec_id = seeded_ec_id ( 'a' , "test01" ) ;
522525 let ec_id = use_seeded_ec ( & client, & seeded_ec_id) ;
523526 log:: info!( "EC full lifecycle: using seeded EC ID = {ec_id}" ) ;
524527
525- // 2. Batch sync writes partner UID (partner "inttest" is in config )
528+ // 2. Batch sync writes partner UID (partner "inttest" is injected )
526529 let mappings = vec ! [ BatchMapping {
527530 ec_id: ec_id. clone( ) ,
528531 partner_uid: "user-uid-42" . to_owned( ) ,
529532 timestamp: 1_700_000_000 ,
530533 } ] ;
531- let resp = batch_sync ( & client, "inttest-api-key-1-32-bytes-minimum" , & mappings) ?;
534+ let resp = batch_sync ( & client, INTTEST_API_TOKEN , & mappings) ?;
532535 let json = assert_json_response ( resp, 200 )
533536 . attach ( "EC full lifecycle: batch sync should return 200" ) ?;
534537
@@ -544,7 +547,7 @@ fn ec_full_lifecycle(base_url: &str) -> TestResult<()> {
544547 }
545548
546549 // 3. Identify with Bearer auth should return the synced UID
547- let json = assert_json_response ( identify ( & client, "inttest-api-key-1-32-bytes-minimum" ) ?, 200 )
550+ let json = assert_json_response ( identify ( & client, INTTEST_API_TOKEN ) ?, 200 )
548551 . attach ( "EC full lifecycle: identify after batch sync" ) ?;
549552
550553 let source_domain = json. get ( "source_domain" ) . and_then ( |v| v. as_str ( ) ) ;
@@ -596,11 +599,11 @@ fn ec_consent_withdrawal(base_url: &str) -> TestResult<()> {
596599
597600 // 3. With consent still granted and the EC cookie revoked, identify should
598601 // now report no EC present.
599- let resp = identify ( & client, "inttest-api-key-1-32-bytes-minimum" ) ?;
602+ let resp = identify ( & client, INTTEST_API_TOKEN ) ?;
600603 assert_status ( & resp, 204 ) . attach ( "identify should return 204 after cookie revocation" ) ?;
601604
602605 // 4. With GPC still asserted, identify should reflect consent denial.
603- let resp = identify_with_headers ( & client, "inttest-api-key-1-32-bytes-minimum" , & [ ( "sec-gpc" , "1" ) ] ) ?;
606+ let resp = identify_with_headers ( & client, INTTEST_API_TOKEN , & [ ( "sec-gpc" , "1" ) ] ) ?;
604607 assert_status ( & resp, 403 )
605608 . attach ( "identify with GPC should return 403 after consent withdrawal" ) ?;
606609
@@ -613,7 +616,7 @@ fn ec_identify_without_ec(base_url: &str) -> TestResult<()> {
613616 let client = EcTestClient :: new ( base_url) ;
614617 allow_ec_generation ( & client) ;
615618
616- let resp = identify ( & client, "inttest-api-key-1-32-bytes-minimum" ) ?;
619+ let resp = identify ( & client, INTTEST_API_TOKEN ) ?;
617620 assert_status ( & resp, 204 )
618621 . attach ( "identify without EC cookie should return 204 when consent is granted" ) ?;
619622
@@ -631,7 +634,7 @@ fn ec_identify_consent_denied(base_url: &str) -> TestResult<()> {
631634 // Identify with GPC=1 — in the default US-CA test geo, GPC is an explicit
632635 // denial that must override the allow cookie. Per spec §11.4, consent is
633636 // evaluated after Bearer auth, so this must be 403 Forbidden.
634- let resp = identify_with_headers ( & client, "inttest-api-key-1-32-bytes-minimum" , & [ ( "sec-gpc" , "1" ) ] ) ?;
637+ let resp = identify_with_headers ( & client, INTTEST_API_TOKEN , & [ ( "sec-gpc" , "1" ) ] ) ?;
635638
636639 let status = resp. status ( ) . as_u16 ( ) ;
637640 if status != 403 {
@@ -654,25 +657,25 @@ fn ec_concurrent_partner_syncs(base_url: &str) -> TestResult<()> {
654657 let ec_id = use_seeded_ec ( & client, & seeded_ec_id) ;
655658 log:: info!( "EC concurrent syncs: using seeded EC = {ec_id}" ) ;
656659
657- // Batch sync both partners (both are pre-configured in trusted-server.toml)
660+ // Batch sync both partners injected by the integration-test build.
658661 let mappings_a = vec ! [ BatchMapping {
659662 ec_id: ec_id. clone( ) ,
660663 partner_uid: "uid-a" . to_owned( ) ,
661664 timestamp: 1_700_000_000 ,
662665 } ] ;
663- let resp = batch_sync ( & client, "inttest-api-key-1-32-bytes-minimum" , & mappings_a) ?;
666+ let resp = batch_sync ( & client, INTTEST_API_TOKEN , & mappings_a) ?;
664667 assert_json_response ( resp, 200 ) . attach ( "batch sync inttest should succeed" ) ?;
665668
666669 let mappings_b = vec ! [ BatchMapping {
667670 ec_id: ec_id. clone( ) ,
668671 partner_uid: "uid-b" . to_owned( ) ,
669672 timestamp: 1_700_000_000 ,
670673 } ] ;
671- let resp = batch_sync ( & client, "inttest2-api-key-2-32-bytes-minimum" , & mappings_b) ?;
674+ let resp = batch_sync ( & client, INTTEST2_API_TOKEN , & mappings_b) ?;
672675 assert_json_response ( resp, 200 ) . attach ( "batch sync inttest2 should succeed" ) ?;
673676
674677 // Identify as inttest → should see only inttest's UID
675- let json = assert_json_response ( identify ( & client, "inttest-api-key-1-32-bytes-minimum" ) ?, 200 )
678+ let json = assert_json_response ( identify ( & client, INTTEST_API_TOKEN ) ?, 200 )
676679 . attach ( "identify as inttest after dual sync" ) ?;
677680 let uid = json. get ( "uid" ) . and_then ( |v| v. as_str ( ) ) ;
678681 if uid != Some ( "uid-a" ) {
@@ -686,7 +689,7 @@ fn ec_concurrent_partner_syncs(base_url: &str) -> TestResult<()> {
686689 }
687690
688691 // Identify as inttest2 → should see only inttest2's UID
689- let json = assert_json_response ( identify ( & client, "inttest2-api-key-2-32-bytes-minimum" ) ?, 200 )
692+ let json = assert_json_response ( identify ( & client, INTTEST2_API_TOKEN ) ?, 200 )
690693 . attach ( "identify as inttest2 after dual sync" ) ?;
691694 let uid = json. get ( "uid" ) . and_then ( |v| v. as_str ( ) ) ;
692695 if uid != Some ( "uid-b" ) {
@@ -705,21 +708,21 @@ fn ec_concurrent_partner_syncs(base_url: &str) -> TestResult<()> {
705708
706709/// Batch sync happy path: authenticated request writes UID, verify via identify.
707710///
708- /// Uses the `inttest` partner pre-configured in `trusted-server.toml` .
711+ /// Uses the `inttest` partner injected by the integration-test build .
709712fn ec_batch_sync_happy_path ( base_url : & str ) -> TestResult < ( ) > {
710713 let client = EcTestClient :: new ( base_url) ;
711714 allow_ec_generation ( & client) ;
712715 let seeded_ec_id = seeded_ec_id ( 'e' , "test05" ) ;
713716 let ec_id = use_seeded_ec ( & client, & seeded_ec_id) ;
714717 log:: info!( "EC batch sync happy path: using seeded ec_id = {ec_id}" ) ;
715718
716- // Batch sync writes a UID for this EC ID (partner "inttest" is in config )
719+ // Batch sync writes a UID for this EC ID (partner "inttest" is injected )
717720 let mappings = vec ! [ BatchMapping {
718721 ec_id: ec_id. clone( ) ,
719722 partner_uid: "batch-uid-99" . to_owned( ) ,
720723 timestamp: 1_700_000_000 ,
721724 } ] ;
722- let resp = batch_sync ( & client, "inttest-api-key-1-32-bytes-minimum" , & mappings) ?;
725+ let resp = batch_sync ( & client, INTTEST_API_TOKEN , & mappings) ?;
723726 let json = assert_json_response ( resp, 200 ) . attach ( "batch sync should return 200" ) ?;
724727
725728 let accepted = json. get ( "accepted" ) . and_then ( |v| v. as_u64 ( ) ) ;
@@ -734,7 +737,7 @@ fn ec_batch_sync_happy_path(base_url: &str) -> TestResult<()> {
734737 }
735738
736739 // Verify via identify (Bearer auth, scoped response)
737- let json = assert_json_response ( identify ( & client, "inttest-api-key-1-32-bytes-minimum" ) ?, 200 )
740+ let json = assert_json_response ( identify ( & client, INTTEST_API_TOKEN ) ?, 200 )
738741 . attach ( "identify after batch sync" ) ?;
739742
740743 let uid = json. get ( "uid" ) . and_then ( |v| v. as_str ( ) ) ;
0 commit comments