def ForTest(file_system, base_path='/'): object_store_creator = ObjectStoreCreator.ForTest() return ServerInstance(object_store_creator, CompiledFileSystem.Factory(object_store_creator), TestBranchUtility.CreateWithCannedData(), HostFileSystemProvider.ForTest( file_system, object_store_creator), GithubFileSystemProvider.ForEmpty(), base_path=base_path)
def ForTest(file_system=None, file_system_provider=None, base_path='/'): object_store_creator = ObjectStoreCreator.ForTest() if file_system is None and file_system_provider is None: raise ValueError('Either |file_system| or |file_system_provider| ' 'must be specified') if file_system and file_system_provider: raise ValueError( 'Only one of |file_system| and |file_system_provider| ' 'can be specified') if file_system_provider is None: file_system_provider = HostFileSystemProvider.ForTest( file_system, object_store_creator) return ServerInstance(object_store_creator, CompiledFileSystem.Factory(object_store_creator), TestBranchUtility.CreateWithCannedData(), file_system_provider, GithubFileSystemProvider.ForEmpty(), base_path=base_path)
def CreateHostFileSystemProvider(self, object_store_creator): return HostFileSystemProvider.ForTest(FailOnAccessFileSystem(), object_store_creator)