Skip to content

Commit 19d0b3b

Browse files
committed
💥 return 410 (gone) when asking for a token
1 parent d2bceca commit 19d0b3b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

flask-data/smarter/resources/auth.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ def post(self):
4444
description: Your password
4545
4646
responses:
47-
200:
48-
description: A standard message
47+
410:
48+
description:
49+
Token has been removed after public release
50+
Please update your Smarter API client to the latest
51+
version
4952
"""
5053
try:
5154
# consume request body but don't do anything with it
@@ -59,7 +62,7 @@ def post(self):
5962
"version")
6063
}),
6164
mimetype="application/json",
62-
status=200)
65+
status=410)
6366

6467
return response
6568

flask-data/smarter/tests/test_login.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_successful_login(self):
2323

2424
# Then
2525
self.assertEqual(str, type(response.json['message']))
26-
self.assertEqual(200, response.status_code)
26+
self.assertEqual(410, response.status_code)
2727

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

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

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

0 commit comments

Comments
 (0)