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 | |
10 from testing_utils import testing | 9 from testing_utils import testing |
11 | 10 |
12 from common import cache_decorator | 11 from lib import cache_decorator |
13 | 12 |
14 | 13 |
15 class _DummyCacher(cache_decorator.Cacher): | 14 class _DummyCacher(cache_decorator.Cacher): |
16 def __init__(self, cached_data): | 15 def __init__(self, cached_data): |
17 self.cached_data = cached_data | 16 self.cached_data = cached_data |
18 | 17 |
19 def Get(self, key): | 18 def Get(self, key): |
20 return self.cached_data.get(key) | 19 return self.cached_data.get(key) |
21 | 20 |
22 def Set(self, key, data, expire_time=0): | 21 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 | 154 return self.url + '/' + path |
156 | 155 |
157 a1 = A('http://test', 3) | 156 a1 = A('http://test', 3) |
158 self.assertEqual('http://test/p1', a1.Func('p1')) | 157 self.assertEqual('http://test/p1', a1.Func('p1')) |
159 self.assertEqual('http://test/p1', a1.Func('p1')) | 158 self.assertEqual('http://test/p1', a1.Func('p1')) |
160 self.assertEqual(1, a1.runs) | 159 self.assertEqual(1, a1.runs) |
161 | 160 |
162 a2 = A('http://test', 5) | 161 a2 = A('http://test', 5) |
163 self.assertEqual('http://test/p1', a2.Func('p1')) | 162 self.assertEqual('http://test/p1', a2.Func('p1')) |
164 self.assertEqual(0, a2.runs) | 163 self.assertEqual(0, a2.runs) |
OLD | NEW |