| 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 content_providers import IgnoreMissingContentProviders | 10 from content_providers import IgnoreMissingContentProviders |
| 11 from cron_servlet import CronServlet | 11 from cron_servlet import CronServlet |
| 12 from empty_dir_file_system import EmptyDirFileSystem | 12 from empty_dir_file_system import EmptyDirFileSystem |
| 13 from extensions_paths import ( | 13 from extensions_paths import ( |
| 14 APP_YAML, CONTENT_PROVIDERS, EXTENSIONS, PUBLIC_TEMPLATES, SERVER2, | 14 APP_YAML, CONTENT_PROVIDERS, CHROME_EXTENSIONS, PUBLIC_TEMPLATES, SERVER2, |
| 15 STATIC_DOCS) | 15 STATIC_DOCS) |
| 16 from gcs_file_system_provider import CloudStorageFileSystemProvider | 16 from gcs_file_system_provider import CloudStorageFileSystemProvider |
| 17 from github_file_system_provider import GithubFileSystemProvider | 17 from github_file_system_provider import GithubFileSystemProvider |
| 18 from host_file_system_provider import HostFileSystemProvider | 18 from host_file_system_provider import HostFileSystemProvider |
| 19 from local_file_system import LocalFileSystem | 19 from local_file_system import LocalFileSystem |
| 20 from mock_file_system import MockFileSystem | 20 from mock_file_system import MockFileSystem |
| 21 from servlet import Request | 21 from servlet import Request |
| 22 from test_branch_utility import TestBranchUtility | 22 from test_branch_utility import TestBranchUtility |
| 23 from test_file_system import MoveTo, TestFileSystem | 23 from test_file_system import MoveTo, TestFileSystem |
| 24 from test_util import EnableLogging, ReadFile | 24 from test_util import EnableLogging, ReadFile |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 }) | 148 }) |
| 149 | 149 |
| 150 storage_html_path = PUBLIC_TEMPLATES + 'apps/storage.html' | 150 storage_html_path = PUBLIC_TEMPLATES + 'apps/storage.html' |
| 151 static_txt_path = STATIC_DOCS + 'static.txt' | 151 static_txt_path = STATIC_DOCS + 'static.txt' |
| 152 | 152 |
| 153 def create_file_system(revision=None): | 153 def create_file_system(revision=None): |
| 154 '''Creates a MockFileSystem at |revision| by applying that many |updates| | 154 '''Creates a MockFileSystem at |revision| by applying that many |updates| |
| 155 to it. | 155 to it. |
| 156 ''' | 156 ''' |
| 157 mock_file_system = MockFileSystem( | 157 mock_file_system = MockFileSystem( |
| 158 TestFileSystem(test_data, relative_to=EXTENSIONS)) | 158 TestFileSystem(test_data, relative_to=CHROME_EXTENSIONS)) |
| 159 updates_for_revision = ( | 159 updates_for_revision = ( |
| 160 updates if revision is None else updates[:int(revision)]) | 160 updates if revision is None else updates[:int(revision)]) |
| 161 for update in updates_for_revision: | 161 for update in updates_for_revision: |
| 162 mock_file_system.Update(update) | 162 mock_file_system.Update(update) |
| 163 return mock_file_system | 163 return mock_file_system |
| 164 | 164 |
| 165 delegate = _TestDelegate(create_file_system) | 165 delegate = _TestDelegate(create_file_system) |
| 166 delegate.SetAppVersion('2-0-8') | 166 delegate.SetAppVersion('2-0-8') |
| 167 | 167 |
| 168 file_systems = delegate.file_systems | 168 file_systems = delegate.file_systems |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 self.assertEqual(AppYamlHelper.GenerateAppYaml('2-1-0'), | 236 self.assertEqual(AppYamlHelper.GenerateAppYaml('2-1-0'), |
| 237 file_systems[-1].ReadSingle(APP_YAML).Get()) | 237 file_systems[-1].ReadSingle(APP_YAML).Get()) |
| 238 self.assertEqual('<h1>y</h1> u not update!', | 238 self.assertEqual('<h1>y</h1> u not update!', |
| 239 file_systems[-1].ReadSingle(storage_html_path).Get()) | 239 file_systems[-1].ReadSingle(storage_html_path).Get()) |
| 240 self.assertEqual('important content!', | 240 self.assertEqual('important content!', |
| 241 file_systems[-1].ReadSingle(static_txt_path).Get()) | 241 file_systems[-1].ReadSingle(static_txt_path).Get()) |
| 242 | 242 |
| 243 | 243 |
| 244 if __name__ == '__main__': | 244 if __name__ == '__main__': |
| 245 unittest.main() | 245 unittest.main() |
| OLD | NEW |