Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/common/extensions/docs/server2/cron_servlet_test.py

Issue 17397010: Adding AvailabilityFinder to Doc Server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Second Round of Smaller Fixes Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 local_file_system import LocalFileSystem 12 from local_file_system import LocalFileSystem
13 from mock_file_system import MockFileSystem 13 from mock_file_system import MockFileSystem
14 from servlet import Request 14 from servlet import Request
15 from test_branch_utility import TestBranchUtility 15 from test_branch_utility import TestBranchUtility
16 from test_file_system import TestFileSystem 16 from test_file_system import TestFileSystem
17 from test_util import EnableLogging 17 from test_util import EnableLogging
18 18
19 # NOTE(kalman): The ObjectStore created by the CronServlet is backed onto our 19 # NOTE(kalman): The ObjectStore created by the CronServlet is backed onto our
20 # fake AppEngine memcache/datastore, so the tests aren't isolated. Of course, 20 # fake AppEngine memcache/datastore, so the tests aren't isolated. Of course,
21 # if the host file systems have different identities, they will be, sort of. 21 # if the host file systems have different identities, they will be, sort of.
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() 30 return TestBranchUtility.CreateWithCannedData()
31 31
32 def CreateHostFileSystemForBranchAndRevision(self, branch, revision): 32 def CreateHostFileSystemForBranchAndRevision(self, branch, revision):
33 file_system = self._create_file_system(revision) 33 file_system = self._create_file_system(revision)
34 self.file_systems.append(file_system) 34 self.file_systems.append(file_system)
35 return file_system 35 return file_system
36 36
37 def CreateAppSamplesFileSystem(self, object_store_creator): 37 def CreateAppSamplesFileSystem(self, object_store_creator):
38 return EmptyDirFileSystem() 38 return EmptyDirFileSystem()
39 39
40 def GetAppVersion(self): 40 def GetAppVersion(self):
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 CronServlet(Request.ForTest('trunk'), delegate_for_test=delegate).Get() 193 CronServlet(Request.ForTest('trunk'), delegate_for_test=delegate).Get()
194 self.assertEqual(AppYamlHelper.GenerateAppYaml('2-1-0'), 194 self.assertEqual(AppYamlHelper.GenerateAppYaml('2-1-0'),
195 file_systems[-1].ReadSingle(app_yaml_path)) 195 file_systems[-1].ReadSingle(app_yaml_path))
196 self.assertEqual('y u not update!', 196 self.assertEqual('y u not update!',
197 file_systems[-1].ReadSingle(storage_html_path)) 197 file_systems[-1].ReadSingle(storage_html_path))
198 self.assertEqual('important content!', 198 self.assertEqual('important content!',
199 file_systems[-1].ReadSingle(static_txt_path)) 199 file_systems[-1].ReadSingle(static_txt_path))
200 200
201 if __name__ == '__main__': 201 if __name__ == '__main__':
202 unittest.main() 202 unittest.main()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/cron.yaml ('k') | chrome/common/extensions/docs/server2/instance_servlet_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698