def setUp(self): self._branch_util = BranchUtility( os.path.join('branch_utility', 'first.json'), { 'extensions': 'stable', 'apps': 'trunk' }, FakeUrlFetcher(os.path.join(sys.path[0], 'test_data')), InMemoryObjectStore(''))
def setUp(self): self._branch_utility = BranchUtility( os.path.join('branch_utility', 'first.json'), os.path.join('branch_utility', 'second.json'), FakeUrlFetcher(Server2Path('test_data')), ObjectStoreCreator.ForTest()) self._api_fs_creator = FakeHostFileSystemProvider( CANNED_API_FILE_SYSTEM_DATA) self._node_fs_creator = FakeHostFileSystemProvider( TABS_SCHEMA_BRANCHES) self._api_fs_iterator = HostFileSystemIterator(self._api_fs_creator, self._branch_utility) self._node_fs_iterator = HostFileSystemIterator( self._node_fs_creator, self._branch_utility) # Imitate the actual SVN file system by incrementing the stats for paths # where an API schema has changed. last_stat = type('last_stat', (object, ), {'val': 0}) def stat_paths(file_system, channel_info): if channel_info.version not in TABS_UNMODIFIED_VERSIONS: last_stat.val += 1 # HACK: |file_system| is a MockFileSystem backed by a TestFileSystem. # Increment the TestFileSystem stat count. file_system._file_system.IncrementStat(by=last_stat.val) # Continue looping. The iterator will stop after 'trunk' automatically. return True # Use the HostFileSystemIterator created above to change global stat values # for the TestFileSystems that it creates. self._node_fs_iterator.Ascending( # The earliest version represented with the tabs' test data is 13. self._branch_utility.GetStableChannelInfo(13), stat_paths)
def setUp(self): self._avail_ds_factory = AvailabilityFinder.Factory( ObjectStoreCreator.ForTest(), CompiledFileSystem.Factory( TestFileSystem(CANNED_API_FILE_SYSTEM_DATA['trunk']), ObjectStoreCreator.ForTest()), BranchUtility( os.path.join('branch_utility', 'first.json'), os.path.join('branch_utility', 'second.json'), FakeUrlFetcher(os.path.join(sys.path[0], 'test_data')), ObjectStoreCreator.ForTest()), _CreateCannedFileSystem) self._avail_ds = self._avail_ds_factory.Create()
def setUp(self): tabs_unmodified_versions = (16, 20, 23, 24) self._branch_utility = BranchUtility( os.path.join('branch_utility', 'first.json'), os.path.join('branch_utility', 'second.json'), FakeUrlFetcher(Server2Path('test_data')), ObjectStoreCreator.ForTest()) self._node_fs_creator = FakeHostFileSystemProvider(TABS_SCHEMA_BRANCHES) self._node_fs_iterator = HostFileSystemIterator(self._node_fs_creator, self._branch_utility) test_object_store = ObjectStoreCreator.ForTest() self._avail_finder = AvailabilityFinder( self._branch_utility, CompiledFileSystem.Factory(test_object_store), self._node_fs_iterator, self._node_fs_creator.GetMaster(), test_object_store, 'extensions', SchemaProcessorFactoryForTest()) server_instance = ServerInstance.ForTest( file_system_provider=FakeHostFileSystemProvider( TABS_SCHEMA_BRANCHES)) self._api_models = server_instance.platform_bundle.GetAPIModels( 'extensions') self._json_cache = server_instance.compiled_fs_factory.ForJson( server_instance.host_file_system_provider.GetMaster()) # Imitate the actual SVN file system by incrementing the stats for paths # where an API schema has changed. last_stat = type('last_stat', (object,), {'val': 0}) def stat_paths(file_system, channel_info): if channel_info.version not in tabs_unmodified_versions: last_stat.val += 1 # HACK: |file_system| is a MockFileSystem backed by a TestFileSystem. # Increment the TestFileSystem stat count. file_system._file_system.IncrementStat(by=last_stat.val) # Continue looping. The iterator will stop after 'master' automatically. return True # Use the HostFileSystemIterator created above to change global stat values # for the TestFileSystems that it creates. self._node_fs_iterator.Ascending( # The earliest version represented with the tabs' test data is 13. self._branch_utility.GetStableChannelInfo(13), stat_paths)
def setUp(self): self._branch_utility = BranchUtility( os.path.join('branch_utility', 'first.json'), os.path.join('branch_utility', 'second.json'), FakeUrlFetcher(os.path.join(sys.path[0], 'test_data')), ObjectStoreCreator.ForTest()) def create_availability_finder(file_system_data): fake_host_fs_creator = FakeHostFileSystemProvider(file_system_data) test_object_store = ObjectStoreCreator.ForTest() return AvailabilityFinder( self._branch_utility, CompiledFileSystem.Factory(test_object_store), HostFileSystemIterator(fake_host_fs_creator, self._branch_utility), fake_host_fs_creator.GetTrunk(), test_object_store) self._avail_finder = create_availability_finder( CANNED_API_FILE_SYSTEM_DATA) self._node_avail_finder = create_availability_finder( TABS_SCHEMA_BRANCHES)
def setUp(self): self._branch_util = BranchUtility( os.path.join('branch_utility', 'first.json'), os.path.join('branch_utility', 'second.json'), FakeUrlFetcher(Server2Path('test_data')), ObjectStoreCreator.ForTest())
def _CreateSubversionFileSystem(path): fetcher = FakeUrlFetcher(path) return SubversionFileSystem(fetcher, fetcher, path), fetcher
def _CreateSubversionFileSystem(self): fetcher = FakeUrlFetcher(self._base_path) return SubversionFileSystem(fetcher, fetcher, self._base_path)
def setUp(self): self._base_path = os.path.join(sys.path[0], 'test_data', 'file_system') fetcher = FakeUrlFetcher(self._base_path) self._file_system = SubversionFileSystem(fetcher, fetcher)
def setUp(self): self._branch_util = BranchUtility( os.path.join('branch_utility', 'first.json'), FakeUrlFetcher(os.path.join(sys.path[0], 'test_data')), object_store=TestObjectStore('test'))