Display a flash message when a user logs out

This commit is contained in:
richard-dds
2019-05-28 16:55:52 -04:00
parent 227feab972
commit c653cf2dbf
4 changed files with 24 additions and 0 deletions

View File

@@ -202,6 +202,20 @@ def test_logout(app, client, monkeypatch):
assert destination == url_for("atst.root")
def test_logging_out_creates_a_flash_message(app, client, monkeypatch):
monkeypatch.setattr(
"atst.domain.authnid.AuthenticationContext.authenticate", lambda s: True
)
monkeypatch.setattr(
"atst.domain.authnid.AuthenticationContext.get_user",
lambda s: UserFactory.create(),
)
_login(client)
logout_response = client.get(url_for("atst.logout"), follow_redirects=True)
assert "Logged out" in logout_response.data.decode()
def test_redirected_on_login(client, monkeypatch):
monkeypatch.setattr(
"atst.domain.authnid.AuthenticationContext.authenticate", lambda *args: True