Skip to content

Commit

Permalink
test: modify login test to approve dex confirmation page
Browse files Browse the repository at this point in the history
  • Loading branch information
chaen committed Jan 24, 2024
1 parent 027085f commit 10fd705
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion diracx-testing/src/diracx/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 10fd705

Please sign in to comment.