Skip to content

Commit

Permalink
Django 5.0 forces POST method for logouts
Browse files Browse the repository at this point in the history
  • Loading branch information
claudep committed Feb 3, 2024
1 parent 07d8265 commit ca8de19
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test_views_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ def test_with_remember(self):
self.assertEqual(1, len([cookie for cookie in response.cookies if cookie.startswith('remember-cookie_')]))

# Logout
self.client.get(reverse('logout'))
self.client.post(reverse('logout'))
response = self.client.get('/secure/raises/')
self.assertEqual(response.status_code, 403)

Expand Down Expand Up @@ -733,7 +733,7 @@ def test_without_remember(self):
self.assertEqual(0, len([cookie for cookie in response.cookies if cookie.startswith('remember-cookie_')]))

# Logout
self.client.get(reverse('logout'))
self.client.post(reverse('logout'))
response = self.client.get('/secure/raises/')
self.assertEqual(response.status_code, 403)

Expand All @@ -758,7 +758,7 @@ def test_expired(self):
self.assertEqual(1, len([cookie for cookie in response.cookies if cookie.startswith('remember-cookie_')]))

# Logout
self.client.get(reverse('logout'))
self.client.post(reverse('logout'))
response = self.client.get('/secure/raises/')
self.assertEqual(response.status_code, 403)

Expand Down Expand Up @@ -790,7 +790,7 @@ def test_wrong_signature(self):
self.assertEqual(1, len([cookie for cookie in response.cookies if cookie.startswith('remember-cookie_')]))

# Logout
self.client.get(reverse('logout'))
self.client.post(reverse('logout'))
response = self.client.get('/secure/raises/')
self.assertEqual(response.status_code, 403)

Expand Down Expand Up @@ -822,7 +822,7 @@ def test_remember_token_throttling(self):
self.assertEqual(1, len([cookie for cookie in response.cookies if cookie.startswith('remember-cookie_')]))

# Logout
self.client.get(reverse('logout'))
self.client.post(reverse('logout'))

# Login having an invalid remember cookie
self.set_invalid_remember_cookie()
Expand Down Expand Up @@ -877,7 +877,7 @@ def test_phonedevice_with_remember_cookie(self, mock_signal, fake):
self.assertRedirects(response, resolve_url(settings.LOGIN_REDIRECT_URL))

# Logout
self.client.get(reverse('logout'))
self.client.post(reverse('logout'))

# Ask for SMS challenge
response = self._post({'auth-username': '[email protected]',
Expand Down

0 comments on commit ca8de19

Please sign in to comment.