From 7aaacfb375a0a407a15abc4c498352a926b92357 Mon Sep 17 00:00:00 2001 From: bt-dlagin Date: Tue, 14 Jan 2025 10:39:02 +0100 Subject: [PATCH] [18.0][MIG] auth_saml: Migration to 18.0 --- auth_saml/tests/test_pysaml.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/auth_saml/tests/test_pysaml.py b/auth_saml/tests/test_pysaml.py index 91b5ba697a..a4005feb24 100644 --- a/auth_saml/tests/test_pysaml.py +++ b/auth_saml/tests/test_pysaml.py @@ -3,6 +3,7 @@ import html import os import urllib +import saml2.xmldsig as ds from unittest.mock import patch from odoo.exceptions import AccessDenied, UserError, ValidationError @@ -469,3 +470,15 @@ def test_sig_alg_selection(self): ("SIG_RSA_SHA512", "SIG_RSA_SHA512"), ] self.assertEqual(self.saml_provider._sig_alg_selection(), expected_selection) + + def test_saml_metadata_invalid_provider(self): + """Accessing SAML metadata with an invalid provider ID should return 404.""" + response = self.url_open(f"/auth_saml/metadata?p=999999&d={self.env.cr.dbname}") + self.assertEqual(response.status_code, 404) + self.assertIn("Unknown provider", response.text) + + def test_saml_metadata_missing_parameters(self): + """Accessing the SAML metadata endpoint without params should return 404.""" + response = self.url_open("/auth_saml/metadata") + self.assertEqual(response.status_code, 404) + self.assertIn("Missing parameters", response.text)