Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Unified Diff: client/tests/auth_server_test.py

Issue 2963103002: Always treat TokenError as fatal error. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/swarming/swarming_bot/bot_code/bot_auth.py ('k') | client/utils/auth_server.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/tests/auth_server_test.py
diff --git a/client/tests/auth_server_test.py b/client/tests/auth_server_test.py
index 2f18f6fe0b348a3a840cd5781659c8f60ff3d5cf..0e09d8dfd8644f69c856d6d2d0fd2622e24250f3 100755
--- a/client/tests/auth_server_test.py
+++ b/client/tests/auth_server_test.py
@@ -116,34 +116,22 @@ class LocalAuthServerTest(auto_stub.TestCase):
self.assertEqual([('acc_1', ('A', 'B', 'C'))], calls)
def test_handles_token_errors(self):
- fatal = False
- code = 123
+ calls = []
def token_gen(_account_id, _scopes):
- raise auth_server.TokenError(code, 'error message', fatal=fatal)
+ calls.append(1)
+ raise auth_server.TokenError(123, 'error message')
with local_auth_server(token_gen, 'acc_1'):
self.assertEqual(
{u'error_code': 123, u'error_message': u'error message'},
call_rpc('acc_1', ['B', 'B', 'A', 'C']))
+ self.assertEqual(1, len(calls))
- # Non-fatal errors aren't cached.
- code = 456
- self.assertEqual(
- {u'error_code': 456, u'error_message': u'error message'},
- call_rpc('acc_1', ['B', 'B', 'A', 'C']))
-
- # Fatal errors are cached.
- fatal = True
- code = 789
+ # Errors are cached. Same error is returned.
self.assertEqual(
- {u'error_code': 789, u'error_message': u'error message'},
- call_rpc('acc_1', ['B', 'B', 'A', 'C']))
-
- # Same cached error.
- code = 111
- self.assertEqual(
- {u'error_code': 789, u'error_message': u'error message'},
+ {u'error_code': 123, u'error_message': u'error message'},
call_rpc('acc_1', ['B', 'B', 'A', 'C']))
+ self.assertEqual(1, len(calls))
def test_http_level_errors(self):
def token_gen(_account_id, _scopes):
« no previous file with comments | « appengine/swarming/swarming_bot/bot_code/bot_auth.py ('k') | client/utils/auth_server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698