OLD | NEW |
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 request.POST[main.LOG_PARAM] = 'data to log' | 66 request.POST[main.LOG_PARAM] = 'data to log' |
67 request.POST[main.NEW_ENTRY_PARAM] = 'off' | 67 request.POST[main.NEW_ENTRY_PARAM] = 'off' |
68 request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'off' | 68 request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'off' |
69 | 69 |
70 response = request.get_response(main.app) | 70 response = request.get_response(main.app) |
71 self.assertEqual(response.status_int, 200) | 71 self.assertEqual(response.status_int, 200) |
72 self.assertEqual(response.body, 'Added to existing log entry.') | 72 self.assertEqual(response.body, 'Added to existing log entry.') |
73 | 73 |
74 request = webapp2.Request.blank('/updatelog') | 74 request = webapp2.Request.blank('/updatelog') |
75 request.method = 'POST' | 75 request.method = 'POST' |
| 76 request.POST[main.LOG_PARAM] = 'x' * 1000000 |
| 77 request.POST[main.NEW_ENTRY_PARAM] = 'off' |
| 78 request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'off' |
| 79 |
| 80 response = request.get_response(main.app) |
| 81 self.assertEqual(response.status_int, 200) |
| 82 self.assertEqual(response.body, 'Created new log entry because the previ
ous one exceeded the max length.') |
| 83 |
| 84 request = webapp2.Request.blank('/updatelog') |
| 85 request.method = 'POST' |
76 request.POST[main.LOG_PARAM] = 'data to log' | 86 request.POST[main.LOG_PARAM] = 'data to log' |
77 request.POST[main.NEW_ENTRY_PARAM] = 'off' | 87 request.POST[main.NEW_ENTRY_PARAM] = 'off' |
78 request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'on' | 88 request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'on' |
79 | 89 |
80 response = request.get_response(main.app) | 90 response = request.get_response(main.app) |
81 self.assertEqual(response.status_int, 200) | 91 self.assertEqual(response.status_int, 200) |
82 self.assertEqual(response.body, 'Wrote new no needs rebaseline log.') | 92 self.assertEqual(response.body, 'Wrote new no needs rebaseline log.') |
83 | 93 |
84 response = request.get_response(main.app) | 94 response = request.get_response(main.app) |
85 self.assertEqual(response.status_int, 200) | 95 self.assertEqual(response.status_int, 200) |
(...skipping 27 matching lines...) Expand all Loading... |
113 request.POST[main.NEW_ENTRY_PARAM] = 'off' | 123 request.POST[main.NEW_ENTRY_PARAM] = 'off' |
114 request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'on' | 124 request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'on' |
115 | 125 |
116 response = request.get_response(main.app) | 126 response = request.get_response(main.app) |
117 self.assertEqual(response.status_int, 200) | 127 self.assertEqual(response.status_int, 200) |
118 self.assertEqual(response.body, 'Wrote new log entry.') | 128 self.assertEqual(response.body, 'Wrote new log entry.') |
119 | 129 |
120 | 130 |
121 if __name__ == '__main__': | 131 if __name__ == '__main__': |
122 unittest.main() | 132 unittest.main() |
OLD | NEW |