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

Side by Side Diff: appengine/chromium_cq_status/handlers/test/post_test.py

Issue 2111713004: Teach CQ status app to check login status of users. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Review and tests. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 json 5 import json
6 6
7 from third_party.testing_utils import testing 7 from third_party.testing_utils import testing
8 8
9 from webtest.app import AppError
10
9 import main 11 import main
10
11 from model.password import Password 12 from model.password import Password
12 from model.record import Record 13 from model.record import Record
13 from shared.config import CQ_BOT_PASSWORD_KEY 14 from shared.config import CQ_BOT_PASSWORD_KEY
14 from shared import utils 15 from shared import utils
15 16
16 from webtest.app import AppError
17 17
18 class TestPost(testing.AppengineTestCase): 18 class TestPost(testing.AppengineTestCase):
19 app_module = main.app 19 app_module = main.app
20 20
21 def test_post_disallowed(self): 21 def test_post_disallowed(self):
22 self.mock_current_user(is_admin=False) 22 self.mock_current_user(is_admin=False)
23 23
24 # 403 status response crashes webtest. 24 # 403 status response crashes webtest.
25 self.assertRaises(AppError, lambda: self.test_app.post('/post')) 25 self.assertRaises(AppError, lambda: self.test_app.post('/post'))
26 26
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 def test_post_project_missing(self): 150 def test_post_project_missing(self):
151 self.mock_current_user(is_admin=True) 151 self.mock_current_user(is_admin=True)
152 response = self.test_app.get('/post', params={ 152 response = self.test_app.get('/post', params={
153 'key': 'single_packet', 153 'key': 'single_packet',
154 'fields': '{"some": "random"}', 154 'fields': '{"some": "random"}',
155 }) 155 })
156 self.assertEquals('"Project" field missing', response.body) 156 self.assertEquals('"Project" field missing', response.body)
157 record = Record.get_by_id('single_packet') 157 record = Record.get_by_id('single_packet')
158 self.assertIsNone(record) 158 self.assertIsNone(record)
OLDNEW
« no previous file with comments | « appengine/chromium_cq_status/handlers/stats_viewer.py ('k') | appengine/chromium_cq_status/handlers/test/stats_query_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698