Skip to content

Commit

Permalink
tests/dex: Remove semicolon from login URL
Browse files Browse the repository at this point in the history
This URL was extracted from the generated HTML returned by Dex, however
it contains a semicolon, which is not accepted by the latest Go http
library, used by Dex. So our test was broken, since the POST request was
rejected with a 400 status.
  • Loading branch information
gdemonet committed Jun 1, 2022
1 parent 3ba5837 commit 6cca5bf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,16 @@ def dex_login(username, password, should_fail, control_plane_ingress_ep):
auth_form = auth_page.text

# The form action looks like:
# <form method="post" action="/oidc/auth/local/login?back=&amp;amp;state=ABCD">
# <form method="post" action="/oidc/auth/local/login?back=&amp;state=ABCD">
next_path_match = re.search(r'action=[\'"](?P<next_path>/oidc/\S+)[\'"]', auth_form)
assert (
next_path_match is not None
), "Could not find an anchor with `action='/oidc/...'` in Dex response:\n{}".format(
auth_form
)
next_path = next_path_match.group("next_path")
# NOTE: recent versions of Go HTTP lib do not allow semicolons in URLs, so
# we manually replace the URL-encoded "&amp;" with a plain ampersand
next_path = next_path_match.group("next_path").replace("&amp;", "&")

try:
auth_response = session.post(
Expand Down

0 comments on commit 6cca5bf

Please sign in to comment.