Skip to content

Commit

Permalink
💥 return 410 (gone) when asking for a token
Browse files Browse the repository at this point in the history
  • Loading branch information
bunop committed Jun 28, 2024
1 parent d2bceca commit 19d0b3b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions flask-data/smarter/resources/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ def post(self):
description: Your password
responses:
200:
description: A standard message
410:
description:
Token has been removed after public release
Please update your Smarter API client to the latest
version
"""
try:
# consume request body but don't do anything with it
Expand All @@ -59,7 +62,7 @@ def post(self):
"version")
}),
mimetype="application/json",
status=200)
status=410)

return response

Expand Down
8 changes: 4 additions & 4 deletions flask-data/smarter/tests/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_successful_login(self):

# Then
self.assertEqual(str, type(response.json['message']))
self.assertEqual(200, response.status_code)
self.assertEqual(410, response.status_code)

def test_login_with_invalid_user(self):
# Given
Expand All @@ -45,7 +45,7 @@ def test_login_with_invalid_user(self):
"Please update your Smarter API client to the latest version",
response.json['message']
)
self.assertEqual(200, response.status_code)
self.assertEqual(410, response.status_code)

def test_login_with_invalid_password(self):
# Given
Expand All @@ -67,7 +67,7 @@ def test_login_with_invalid_password(self):
"Please update your Smarter API client to the latest version",
response.json['message']
)
self.assertEqual(200, response.status_code)
self.assertEqual(410, response.status_code)

def test_login_with_missing_fields(self):
# Given
Expand All @@ -87,4 +87,4 @@ def test_login_with_missing_fields(self):
"Please update your Smarter API client to the latest version",
response.json['message']
)
self.assertEqual(200, response.status_code)
self.assertEqual(410, response.status_code)

0 comments on commit 19d0b3b

Please sign in to comment.