OLD | NEW |
1 # Copyright (c) 2010 Google Inc. All rights reserved. | 1 # Copyright (c) 2010 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 'Retrying in 0 seconds...\n', | 74 'Retrying in 0 seconds...\n', |
75 'WARNING: Received HTTP status 500 loading "http://examp
le.com/". ' | 75 'WARNING: Received HTTP status 500 loading "http://examp
le.com/". ' |
76 'Retrying in 0.0 seconds...\n']) | 76 'Retrying in 0.0 seconds...\n']) |
77 | 77 |
78 def test_convert_404_to_None(self): | 78 def test_convert_404_to_None(self): |
79 transaction = NetworkTransaction(convert_404_to_None=True) | 79 transaction = NetworkTransaction(convert_404_to_None=True) |
80 self.assertEqual(transaction.run(lambda: self._raise_404_error()), None) | 80 self.assertEqual(transaction.run(lambda: self._raise_404_error()), None) |
81 | 81 |
82 def test_timeout(self): | 82 def test_timeout(self): |
83 self._run_count = 0 | 83 self._run_count = 0 |
84 transaction = NetworkTransaction(initial_backoff_seconds=60*60, timeout_
seconds=60) | 84 transaction = NetworkTransaction(initial_backoff_seconds=60 * 60, timeou
t_seconds=60) |
85 did_process_exception = False | 85 did_process_exception = False |
86 did_throw_exception = True | 86 did_throw_exception = True |
87 try: | 87 try: |
88 transaction.run(lambda: self._raise_500_error()) | 88 transaction.run(lambda: self._raise_500_error()) |
89 did_throw_exception = False | 89 did_throw_exception = False |
90 except NetworkTimeout, e: | 90 except NetworkTimeout, e: |
91 did_process_exception = True | 91 did_process_exception = True |
92 self.assertTrue(did_throw_exception) | 92 self.assertTrue(did_throw_exception) |
93 self.assertTrue(did_process_exception) | 93 self.assertTrue(did_process_exception) |
OLD | NEW |