diff --git a/diracx-testing/src/diracx/testing/__init__.py b/diracx-testing/src/diracx/testing/__init__.py index 02c5a0a0..99a04468 100644 --- a/diracx-testing/src/diracx/testing/__init__.py +++ b/diracx-testing/src/diracx/testing/__init__.py @@ -9,7 +9,7 @@ from html.parser import HTMLParser from pathlib import Path from typing import TYPE_CHECKING -from urllib.parse import urljoin +from urllib.parse import parse_qs, urljoin, urlparse from uuid import uuid4 import pytest @@ -551,5 +551,13 @@ def handle_starttag(self, tag, attrs): verify=ca_path, ) r.raise_for_status() + approval_url = r.url # This is not the same as URL as we redirect to dex + # Do the actual approval + r = requests.post( + approval_url, + {"approval": "approve", "req": parse_qs(urlparse(r.url).query)["req"][0]}, + verify=ca_path, + ) + # This should have redirected to the DiracX page that shows the login is complete assert "Please close the window" in r.text