| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import datetime | 5 import datetime |
| 6 import json | 6 import json |
| 7 import mock | 7 import mock |
| 8 import urllib2 | 8 import urllib2 |
| 9 | 9 |
| 10 from google.appengine.datastore import datastore_stub_util | 10 from google.appengine.datastore import datastore_stub_util |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 patcher.stop() | 981 patcher.stop() |
| 982 | 982 |
| 983 def test_only_chromium_users_are_allowed_to_change(self): | 983 def test_only_chromium_users_are_allowed_to_change(self): |
| 984 self.mock_current_user(user_email='someone@evil-site.com') | 984 self.mock_current_user(user_email='someone@evil-site.com') |
| 985 self.test_app.get('/override_issue_id?key=123&issue_id=0', status=401) | 985 self.test_app.get('/override_issue_id?key=123&issue_id=0', status=401) |
| 986 | 986 |
| 987 def test_validates_issue_id(self): | 987 def test_validates_issue_id(self): |
| 988 self.test_app.get('/override_issue_id?issue_id=foobar', status=400) | 988 self.test_app.get('/override_issue_id?issue_id=foobar', status=400) |
| 989 self.test_app.get('/override_issue_id?issue_id=-5', status=400) | 989 self.test_app.get('/override_issue_id?issue_id=-5', status=400) |
| 990 | 990 |
| 991 def test_checks_issue_is_on_monorail(self): | 991 def test_checks_issue_is_on_crbug(self): |
| 992 self.test_app.get('/override_issue_id?issue_id=200', status=400) | 992 self.test_app.get('/override_issue_id?issue_id=200', status=400) |
| 993 | 993 |
| 994 def test_overrides_issue_id(self): | 994 def test_overrides_issue_id(self): |
| 995 issue = self.mock_api.create(MockIssue({})) | 995 issue = self.mock_api.create(MockIssue({})) |
| 996 key = Flake(name='foobar', issue_id=issue.id).put() | 996 key = Flake(name='foobar', issue_id=issue.id).put() |
| 997 self.test_app.get( | 997 self.test_app.get( |
| 998 '/override_issue_id?key=%s&issue_id=%d' % (key.urlsafe(), issue.id)) | 998 '/override_issue_id?key=%s&issue_id=%d' % (key.urlsafe(), issue.id)) |
| 999 self.assertEqual(key.get().issue_id, issue.id) | 999 self.assertEqual(key.get().issue_id, issue.id) |
| 1000 | 1000 |
| 1001 def test_overrides_issue_id_with_0(self): | 1001 def test_overrides_issue_id_with_0(self): |
| 1002 key = Flake(name='foobar', issue_id=100000).put() | 1002 key = Flake(name='foobar', issue_id=100000).put() |
| 1003 self.test_app.get( | 1003 self.test_app.get( |
| 1004 '/override_issue_id?key=%s&issue_id=0' % key.urlsafe()) | 1004 '/override_issue_id?key=%s&issue_id=0' % key.urlsafe()) |
| 1005 self.assertEqual(key.get().issue_id, 0) | 1005 self.assertEqual(key.get().issue_id, 0) |
| OLD | NEW |