OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import unittest | 6 import unittest |
7 | 7 |
8 from appengine_wrappers import GetAppVersion | 8 from appengine_wrappers import GetAppVersion |
9 from app_yaml_helper import AppYamlHelper | 9 from app_yaml_helper import AppYamlHelper |
10 from cron_servlet import CronServlet | 10 from cron_servlet import CronServlet |
(...skipping 11 matching lines...) Expand all Loading... |
22 class _TestDelegate(CronServlet.Delegate): | 22 class _TestDelegate(CronServlet.Delegate): |
23 def __init__(self, create_file_system): | 23 def __init__(self, create_file_system): |
24 self.file_systems = [] | 24 self.file_systems = [] |
25 # A callback taking a revision and returning a file system. | 25 # A callback taking a revision and returning a file system. |
26 self._create_file_system = create_file_system | 26 self._create_file_system = create_file_system |
27 self._app_version = GetAppVersion() | 27 self._app_version = GetAppVersion() |
28 | 28 |
29 def CreateBranchUtility(self, object_store_creator): | 29 def CreateBranchUtility(self, object_store_creator): |
30 return TestBranchUtility.CreateWithCannedData() | 30 return TestBranchUtility.CreateWithCannedData() |
31 | 31 |
| 32 def CreateFileSystemForBranch(self, branch): |
| 33 return self._create_file_system(branch) |
| 34 |
32 def CreateHostFileSystemForBranchAndRevision(self, branch, revision): | 35 def CreateHostFileSystemForBranchAndRevision(self, branch, revision): |
33 file_system = self._create_file_system(revision) | 36 file_system = self._create_file_system(revision) |
34 self.file_systems.append(file_system) | 37 self.file_systems.append(file_system) |
35 return file_system | 38 return file_system |
36 | 39 |
| 40 def CreateHostFileSystem(self, branch): |
| 41 file_system = self._create_file_system(branch) |
| 42 return file_system |
| 43 |
37 def CreateAppSamplesFileSystem(self, object_store_creator): | 44 def CreateAppSamplesFileSystem(self, object_store_creator): |
38 return EmptyDirFileSystem() | 45 return EmptyDirFileSystem() |
39 | 46 |
40 def GetAppVersion(self): | 47 def GetAppVersion(self): |
41 return self._app_version | 48 return self._app_version |
42 | 49 |
43 # (non-Delegate method). | 50 # (non-Delegate method). |
44 def SetAppVersion(self, app_version): | 51 def SetAppVersion(self, app_version): |
45 self._app_version = app_version | 52 self._app_version = app_version |
46 | 53 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 CronServlet(Request.ForTest('trunk'), delegate_for_test=delegate).Get() | 200 CronServlet(Request.ForTest('trunk'), delegate_for_test=delegate).Get() |
194 self.assertEqual(AppYamlHelper.GenerateAppYaml('2-1-0'), | 201 self.assertEqual(AppYamlHelper.GenerateAppYaml('2-1-0'), |
195 file_systems[-1].ReadSingle(app_yaml_path)) | 202 file_systems[-1].ReadSingle(app_yaml_path)) |
196 self.assertEqual('y u not update!', | 203 self.assertEqual('y u not update!', |
197 file_systems[-1].ReadSingle(storage_html_path)) | 204 file_systems[-1].ReadSingle(storage_html_path)) |
198 self.assertEqual('important content!', | 205 self.assertEqual('important content!', |
199 file_systems[-1].ReadSingle(static_txt_path)) | 206 file_systems[-1].ReadSingle(static_txt_path)) |
200 | 207 |
201 if __name__ == '__main__': | 208 if __name__ == '__main__': |
202 unittest.main() | 209 unittest.main() |
OLD | NEW |