Skip to content

Commit

Permalink
[18.0][MIG] auth_saml: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BT-dlagin committed Jan 14, 2025
1 parent 3c5ec99 commit 7aaacfb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions auth_saml/tests/test_pysaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

0 comments on commit 7aaacfb

Please sign in to comment.