| 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 |
| 11 from empty_dir_file_system import EmptyDirFileSystem | 11 from empty_dir_file_system import EmptyDirFileSystem |
| 12 from github_file_system_provider import GithubFileSystemProvider | 12 from github_file_system_provider import GithubFileSystemProvider |
| 13 from host_file_system_provider import HostFileSystemProvider | 13 from host_file_system_provider import HostFileSystemProvider |
| 14 from local_file_system import LocalFileSystem | 14 from local_file_system import LocalFileSystem |
| 15 from mock_file_system import MockFileSystem | 15 from mock_file_system import MockFileSystem |
| 16 from servlet import Request | 16 from servlet import Request |
| 17 from svn_constants import JSON_PATH |
| 17 from test_branch_utility import TestBranchUtility | 18 from test_branch_utility import TestBranchUtility |
| 18 from test_file_system import TestFileSystem | 19 from test_file_system import TestFileSystem |
| 19 from test_util import EnableLogging | 20 from test_util import EnableLogging, ReadFile |
| 20 | 21 |
| 21 # NOTE(kalman): The ObjectStore created by the CronServlet is backed onto our | 22 # NOTE(kalman): The ObjectStore created by the CronServlet is backed onto our |
| 22 # fake AppEngine memcache/datastore, so the tests aren't isolated. Of course, | 23 # fake AppEngine memcache/datastore, so the tests aren't isolated. Of course, |
| 23 # if the host file systems have different identities, they will be, sort of. | 24 # if the host file systems have different identities, they will be, sort of. |
| 24 class _TestDelegate(CronServlet.Delegate): | 25 class _TestDelegate(CronServlet.Delegate): |
| 25 def __init__(self, create_file_system): | 26 def __init__(self, create_file_system): |
| 26 self.file_systems = [] | 27 self.file_systems = [] |
| 27 # A callback taking a revision and returning a file system. | 28 # A callback taking a revision and returning a file system. |
| 28 self._create_file_system = create_file_system | 29 self._create_file_system = create_file_system |
| 29 self._app_version = GetAppVersion() | 30 self._app_version = GetAppVersion() |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 'templates': { | 100 'templates': { |
| 100 'public': { | 101 'public': { |
| 101 'apps': { | 102 'apps': { |
| 102 'storage.html': 'storage.html contents' | 103 'storage.html': 'storage.html contents' |
| 103 }, | 104 }, |
| 104 'extensions': { | 105 'extensions': { |
| 105 'storage.html': 'storage.html contents' | 106 'storage.html': 'storage.html contents' |
| 106 }, | 107 }, |
| 107 }, | 108 }, |
| 108 'json': { | 109 'json': { |
| 110 'content_providers.json': ReadFile('%s/content_providers.json' % |
| 111 JSON_PATH), |
| 109 'manifest.json': '{}', | 112 'manifest.json': '{}', |
| 110 'strings.json': '{}', | 113 'strings.json': '{}', |
| 111 'apps_sidenav.json': '{}', | 114 'apps_sidenav.json': '{}', |
| 112 'extensions_sidenav.json': '{}', | 115 'extensions_sidenav.json': '{}', |
| 113 }, | 116 }, |
| 114 } | 117 } |
| 115 } | 118 } |
| 116 } | 119 } |
| 117 | 120 |
| 118 updates = [] | 121 updates = [] |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 CronServlet(Request.ForTest('trunk'), delegate_for_test=delegate).Get() | 221 CronServlet(Request.ForTest('trunk'), delegate_for_test=delegate).Get() |
| 219 self.assertEqual(AppYamlHelper.GenerateAppYaml('2-1-0'), | 222 self.assertEqual(AppYamlHelper.GenerateAppYaml('2-1-0'), |
| 220 file_systems[-1].ReadSingle(app_yaml_path).Get()) | 223 file_systems[-1].ReadSingle(app_yaml_path).Get()) |
| 221 self.assertEqual('y u not update!', | 224 self.assertEqual('y u not update!', |
| 222 file_systems[-1].ReadSingle(storage_html_path).Get()) | 225 file_systems[-1].ReadSingle(storage_html_path).Get()) |
| 223 self.assertEqual('important content!', | 226 self.assertEqual('important content!', |
| 224 file_systems[-1].ReadSingle(static_txt_path).Get()) | 227 file_systems[-1].ReadSingle(static_txt_path).Get()) |
| 225 | 228 |
| 226 if __name__ == '__main__': | 229 if __name__ == '__main__': |
| 227 unittest.main() | 230 unittest.main() |
| OLD | NEW |