Skip to content

Commit

Permalink
Merge pull request #97 from salvatorelaiso/feature/polling
Browse files Browse the repository at this point in the history
feat: return the value needed to perform the polling
  • Loading branch information
Giuseppe De Marco authored Aug 10, 2023
2 parents b7c320c + 919f67c commit 7e44bae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyeudiw/satosa/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def pre_request_endpoint(self, context, internal_request, **kwargs):
qrcode = QRCode(res_url, **self.config['qrcode'])

result = self.template.qrcode_page.render(
{"title": "Frame the qrcode", 'qrcode_base64': qrcode.to_base64()}
{"title": "Frame the qrcode", 'qrcode_base64': qrcode.to_base64(), "state": state}
)
return Response(result, content="text/html; charset=utf8", status="200")

Expand Down
1 change: 1 addition & 0 deletions pyeudiw/tests/satosa/templates/qrcode.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

<h1>Inquadra il qr code con il tuo smartphone</h1>

<div id="state" value="{{ state }}"></div>
<img width="33%" src='data:image/svg+xml;base64,{{ qrcode_base64 }}'>

{% endblock body %}
5 changes: 5 additions & 0 deletions pyeudiw/tests/satosa/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,11 @@ def test_pre_request_endpoint(self, context):
# decode the base64 data
decoded = base64.b64decode(data).decode("utf-8")

# get the div with id "state"
state_div = soup.find("div", {"id": "state"})
assert state_div
assert state_div["value"]

svg = BeautifulSoup(decoded, features="xml")
assert svg
assert svg.find("svg")
Expand Down

0 comments on commit 7e44bae

Please sign in to comment.