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

Side by Side Diff: infra_libs/test/instrumented_requests_test.py

Issue 1260293009: make version of ts_mon compatible with appengine (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: add noncululativedistribution metric to ts_mon imports Created 5 years, 4 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 | « infra_libs/test/httplib2_utils_test.py ('k') | infra_libs/ts_mon/__init__.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 unittest 6 import unittest
7 7
8 from infra_libs import http_metrics 8 from infra_libs.ts_mon.common import http_metrics
9 from infra_libs import instrumented_requests 9 from infra_libs import instrumented_requests
10 10
11 import requests 11 import requests
12 import mock 12 import mock
13 13
14 14
15 class InstrumentedRequestsTest(unittest.TestCase): 15 class InstrumentedRequestsTest(unittest.TestCase):
16 def setUp(self): 16 def setUp(self):
17 super(InstrumentedRequestsTest, self).setUp() 17 super(InstrumentedRequestsTest, self).setUp()
18 http_metrics._reset_for_testing() 18 http_metrics._reset_for_testing()
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 '_instrumented_test', 'foo', 'http://example.com', 97 '_instrumented_test', 'foo', 'http://example.com',
98 hooks={'foo': lambda: 42}) 98 hooks={'foo': lambda: 42})
99 99
100 self.assertTrue(f.called) 100 self.assertTrue(f.called)
101 self.assertEquals(('http://example.com',), f.call_args[0]) 101 self.assertEquals(('http://example.com',), f.call_args[0])
102 self.assertIn('hooks', f.call_args[1]) 102 self.assertIn('hooks', f.call_args[1])
103 self.assertIn('response', f.call_args[1]['hooks']) 103 self.assertIn('response', f.call_args[1]['hooks'])
104 self.assertIn('foo', f.call_args[1]['hooks']) 104 self.assertIn('foo', f.call_args[1]['hooks'])
105 self.assertTrue(hasattr(f.call_args[1]['hooks']['response'], '__call__')) 105 self.assertTrue(hasattr(f.call_args[1]['hooks']['response'], '__call__'))
106 self.assertEquals(42, f.call_args[1]['hooks']['foo']()) 106 self.assertEquals(42, f.call_args[1]['hooks']['foo']())
OLDNEW
« no previous file with comments | « infra_libs/test/httplib2_utils_test.py ('k') | infra_libs/ts_mon/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698