Skip to content

Commit

Permalink
fixup: add unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
gurneyalex committed Jan 16, 2024
1 parent 984a1fe commit e29cac1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions auth_saml/tests/test_pysaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)

0 comments on commit e29cac1

Please sign in to comment.