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 ForLocal(): object_store_creator = ObjectStoreCreator(start_empty=False, store_type=TestObjectStore) host_file_system_provider = HostFileSystemProvider.ForLocal( object_store_creator) return ServerInstance(object_store_creator, CompiledFileSystem.Factory(object_store_creator), TestBranchUtility.CreateWithCannedData(), host_file_system_provider, GithubFileSystemProvider.ForEmpty())
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 CreateGithubFileSystemProvider(self, object_store_creator): return GithubFileSystemProvider.ForEmpty()