mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
tests: Flush session in verify_desktop_flow_end_page in social auth.
As the relevant comment elaborates - what happens next in the test in simulating the step that happens in the desktop app. Thus a new session needs to be used. Otherwise, the old session created normally in the browser pollutes the state and can give falsely passing tests. This should be happening for all social auth tests using this, not just in that one SAML test, thus moving it inside the helper method.
This commit is contained in:
committed by
Tim Abbott
parent
8fb0fe96c6
commit
04f5358a76
@@ -845,6 +845,12 @@ class DesktopFlowTestingLib(ZulipTestCase):
|
||||
self.assertEqual(browser_url, "/login/")
|
||||
decrypted_key = self.verify_desktop_data_and_return_key(desktop_data, desktop_flow_otp)
|
||||
|
||||
# Flush the session to have a clean slate - since up till now
|
||||
# we were simulating the part of the flow that happens in the browser.
|
||||
# Now we will simulating the last part of the flow, which gets executed
|
||||
# in the desktop application - thus with a separate session.
|
||||
self.client.session.flush()
|
||||
|
||||
result = self.client_get(
|
||||
f"http://zulip.testserver/accounts/login/subdomain/{decrypted_key}"
|
||||
)
|
||||
@@ -2153,11 +2159,6 @@ class SAMLAuthBackendTest(SocialAuthBase):
|
||||
expect_choose_email_screen=False,
|
||||
desktop_flow_otp=desktop_flow_otp,
|
||||
)
|
||||
# Flush the session to have a clean slate - since up till now
|
||||
# we were simulating the part of the flow that happens in the browser.
|
||||
# Now we will simulating the last part of the flow, which gets executed
|
||||
# in the desktop application - thus with a separate session.
|
||||
self.client.session.flush()
|
||||
self.verify_desktop_flow_end_page(result, self.email, desktop_flow_otp)
|
||||
|
||||
# Ensure the SessionIndex gets plumbed through to the final session in the app.
|
||||
|
||||
Reference in New Issue
Block a user