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

Side by Side Diff: appengine/findit/handlers/test/process_flake_analysis_request_test.py

Issue 2435983003: [Findit] Asynchronously process flake reports from chromium-try-flakes. (Closed)
Patch Set: Rebase to resolve conflict Created 4 years, 2 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
« no previous file with comments | « appengine/findit/handlers/process_flake_analysis_request.py ('k') | appengine/findit/main.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import mock
6 import pickle
7 import re
8
9 from google.appengine.ext import testbed
10 import webapp2
11 import webtest
12
13 from testing_utils import testing
14
15 from handlers import process_flake_analysis_request
16
17
18 class ProcessFlakeAnalysisRequestsTest(testing.AppengineTestCase):
19 app_module = webapp2.WSGIApplication([
20 ('/process-flake-analysis-request',
21 process_flake_analysis_request.ProcessFlakeAnalysisRequest),
22 ], debug=True)
23
24 def testNonAdminCanNotSendRequest(self):
25 self.assertRaisesRegexp(
26 webtest.app.AppError,
27 re.compile('.*401 Unauthorized.*'
28 'Error: Either not login or no permission.*',
29 re.MULTILINE | re.DOTALL),
30 self.test_app.post,
31 '/process-flake-analysis-request',
32 params='')
33
34 @mock.patch.object(
35 process_flake_analysis_request.flake_analysis_service,
36 'ScheduleAnalysisForFlake')
37 def testAdminCanRequestAnalysis(self, mocked_func):
38 self.mock_current_user(user_email='test@chromium.org', is_admin=True)
39
40 response = self.test_app.post(
41 '/process-flake-analysis-request',
42 params=pickle.dumps(('request', 'email', False)))
43 self.assertEquals(200, response.status_int)
44 mocked_func.assert_call_with(mock.call('request', 'email', False))
OLDNEW
« no previous file with comments | « appengine/findit/handlers/process_flake_analysis_request.py ('k') | appengine/findit/main.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698