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 pickle | 5 import pickle |
6 import zlib | 6 import zlib |
7 | 7 |
8 from google.appengine.api import memcache | 8 from google.appengine.api import memcache |
9 | 9 |
10 from testing_utils import testing | 10 from testing_utils import testing |
11 | 11 |
12 from common import cache_decorator | 12 from gitiles import cache_decorator |
13 | 13 |
14 | 14 |
15 class _DummyCacher(cache_decorator.Cacher): | 15 class _DummyCacher(cache_decorator.Cacher): |
16 def __init__(self, cached_data): | 16 def __init__(self, cached_data): |
17 self.cached_data = cached_data | 17 self.cached_data = cached_data |
18 | 18 |
19 def Get(self, key): | 19 def Get(self, key): |
20 return self.cached_data.get(key) | 20 return self.cached_data.get(key) |
21 | 21 |
22 def Set(self, key, data, expire_time=0): | 22 def Set(self, key, data, expire_time=0): |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 return self.url + '/' + path | 155 return self.url + '/' + path |
156 | 156 |
157 a1 = A('http://test', 3) | 157 a1 = A('http://test', 3) |
158 self.assertEqual('http://test/p1', a1.Func('p1')) | 158 self.assertEqual('http://test/p1', a1.Func('p1')) |
159 self.assertEqual('http://test/p1', a1.Func('p1')) | 159 self.assertEqual('http://test/p1', a1.Func('p1')) |
160 self.assertEqual(1, a1.runs) | 160 self.assertEqual(1, a1.runs) |
161 | 161 |
162 a2 = A('http://test', 5) | 162 a2 = A('http://test', 5) |
163 self.assertEqual('http://test/p1', a2.Func('p1')) | 163 self.assertEqual('http://test/p1', a2.Func('p1')) |
164 self.assertEqual(0, a2.runs) | 164 self.assertEqual(0, a2.runs) |
OLD | NEW |