Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/accounts/tests/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def test_invalid_login(self):
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'Login')

@override_switch('logout', active=True)
@override_switch('show_testclient_link', active=True)
@override_switch('login', active=True)
def test_logout(self):
Expand All @@ -88,6 +89,15 @@ def test_logout(self):
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'Login')

@override_switch('logout', active=False)
@override_switch('login', active=True)
def test_logout_switch_off(self):
"""
Logout endpoint disabled when logout switch is off
"""
response = self.client.get(reverse('logout'), follow=True)
self.assertEqual(response.status_code, 404)

@override_switch('show_testclient_link', active=True)
@override_switch('login', active=True)
def test_valid_login_email(self):
Expand Down
2 changes: 1 addition & 1 deletion apps/accounts/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

urlpatterns = [
path("api/profile", my_profile, name="my_profile"),
path("logout", waffle_switch("login")(LogoutView.as_view()), name="logout"),
path("logout", waffle_switch("logout")(LogoutView.as_view()), name="logout"),
path(
"create",
waffle_switch("signup")(create_account),
Expand Down
2 changes: 1 addition & 1 deletion apps/accounts/v2/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

urlpatterns = [
path("api/profile", my_profile, name="my_profile_v2"),
path("logout", waffle_switch("login")(LogoutView.as_view()), name="logout_v2"),
path("logout", waffle_switch("logout")(LogoutView.as_view()), name="logout_v2"),
path(
"create",
waffle_switch("signup")(create_account),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
("enable_testclient", True, "This enables the test client."),
("expire_grant_endpoint", True, "This enables the /v<1/2>/o/expire_authenticated_user/<patient_id>/ endpoint."),
("login", True, "This enables login related URLs and code. See apps/accounts/urls.py file for more info."),
("logout", True, "This enables logout related URLs and code. See apps/accounts/urls.py file for more info."),
("outreach_email", True, "This enables developer outreach emails. Not active in prod."),
("require_pkce", True, "This enforces the presence of the PKCE parameters code_challenge and code_challenge_method when authorizing"),
("require_state", True, "This enforces the presence of the state parameter when authorizing"),
Expand Down
Loading