From e29cac1bc39e67efeaef63be6c3d76c666584cc6 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Tue, 16 Jan 2024 09:01:02 +0100 Subject: [PATCH] fixup: add unittest --- auth_saml/tests/test_pysaml.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/auth_saml/tests/test_pysaml.py b/auth_saml/tests/test_pysaml.py index c05235b747..2ed02fff3a 100644 --- a/auth_saml/tests/test_pysaml.py +++ b/auth_saml/tests/test_pysaml.py @@ -4,6 +4,8 @@ import os from unittest.mock import patch +import responses + from odoo.exceptions import AccessDenied, UserError, ValidationError from odoo.tests import HttpCase, tagged @@ -336,3 +338,18 @@ def test_redirect_after_login(self): self.base_url() + "/web#action=37&model=ir.module.module&view_type=kanban&menu_id=5", ) + + @responses.activate + def test_download_metadata(self): + expected_metadata = self.idp.get_metadata() + responses.add( + responses.GET, + "http://localhost:8000/metadata", + status=200, + content_type="text/xml", + body=expected_metadata, + ) + self.saml_provider.idp_metadata_url = "http://localhost:8000/metadata" + self.saml_provider.idp_metadata = "" + self.saml_provider.action_refresh_metadata_from_url() + self.assertEqual(self.saml_provider.idp_metadata, expected_metadata)