Fix OpsProof operator authorization tests
Homelab Main / validate (push) Failing after 1m31s Details
Homelab Main / running-update (push) Has been skipped Details
Homelab Main / debian-ops (push) Has been skipped Details

This commit is contained in:
juvenal.diaz 2026-12-04 20:24:11 -06:00
parent 2927b05f3f
commit 380ff65c43
4 changed files with 9 additions and 0 deletions

View File

@ -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",

View File

@ -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":

View File

@ -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 {

View File

@ -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"
)