From 380ff65c434f2d686d34a7e94a419cc4652c884d Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Fri, 4 Dec 2026 20:24:11 -0600 Subject: [PATCH] Fix OpsProof operator authorization tests --- apps/opsproof/overlay/tests/feature/authentication_test.go | 2 ++ apps/opsproof/overlay/tests/feature/incident_test.go | 1 + apps/opsproof/overlay/tests/feature/proposal_test.go | 1 + tests/jeannie/test_privacy_services_pipeline.py | 5 +++++ 4 files changed, 9 insertions(+) diff --git a/apps/opsproof/overlay/tests/feature/authentication_test.go b/apps/opsproof/overlay/tests/feature/authentication_test.go index 07bd0a9..1ac086d 100644 --- a/apps/opsproof/overlay/tests/feature/authentication_test.go +++ b/apps/opsproof/overlay/tests/feature/authentication_test.go @@ -10,6 +10,7 @@ import ( ) func TestDexLoginRequiresAnAllowedVerifiedOperator(t *testing.T) { + t.Setenv("OPSPROOF_OPERATOR_EMAILS", "operator@example.test") client := tests.New(t, laraveltest.Env(map[string]string{ "OPSPROOF_DEX_ISSUER": "https://auth.example.test", "OPSPROOF_DEX_CLIENT_SECRET": "test-secret", @@ -29,6 +30,7 @@ func TestDexLoginRequiresAnAllowedVerifiedOperator(t *testing.T) { } func TestDexLoginRejectsAnUnlistedIdentity(t *testing.T) { + t.Setenv("OPSPROOF_OPERATOR_EMAILS", "operator@example.test") client := tests.New(t, laraveltest.Env(map[string]string{ "OPSPROOF_DEX_ISSUER": "https://auth.example.test", "OPSPROOF_DEX_CLIENT_SECRET": "test-secret", diff --git a/apps/opsproof/overlay/tests/feature/incident_test.go b/apps/opsproof/overlay/tests/feature/incident_test.go index c895d3c..c2f5425 100644 --- a/apps/opsproof/overlay/tests/feature/incident_test.go +++ b/apps/opsproof/overlay/tests/feature/incident_test.go @@ -12,6 +12,7 @@ import ( ) func TestIncidentPageRendersDeterministicDoctorEvidence(t *testing.T) { + t.Setenv("OPSPROOF_OPERATOR_EMAILS", "operator@example.test") server := httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) { switch request.URL.Path { case "/v1/execute": diff --git a/apps/opsproof/overlay/tests/feature/proposal_test.go b/apps/opsproof/overlay/tests/feature/proposal_test.go index e37e3c3..92dc72e 100644 --- a/apps/opsproof/overlay/tests/feature/proposal_test.go +++ b/apps/opsproof/overlay/tests/feature/proposal_test.go @@ -15,6 +15,7 @@ import ( ) func TestProposalApprovalRevalidatesAndSubmitsExactDoctorAction(t *testing.T) { + t.Setenv("OPSPROOF_OPERATOR_EMAILS", "operator@example.test") doctorRequests := 0 server := httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) { switch request.URL.Path { diff --git a/tests/jeannie/test_privacy_services_pipeline.py b/tests/jeannie/test_privacy_services_pipeline.py index b63878d..93b4c8e 100644 --- a/tests/jeannie/test_privacy_services_pipeline.py +++ b/tests/jeannie/test_privacy_services_pipeline.py @@ -144,6 +144,11 @@ class OpsProofPipelineTests(unittest.TestCase): self.assertIn("operatorAllowed(email)", auth_handler) self.assertIn("auth.Login", auth_handler) + auth_test = ( + ROOT / "apps/opsproof/overlay/tests/feature/authentication_test.go" + ).read_text(encoding="utf-8") + self.assertIn('t.Setenv("OPSPROOF_OPERATOR_EMAILS"', auth_test) + routes = (ROOT / "apps/opsproof/overlay/routes/web.go").read_text( encoding="utf-8" )