l.s.l.t.f.FakeLibrarian(Fixture) : class documentation

Part of lp.services.librarianserver.testing.fake View In Hierarchy

A test double Librarian which works in-process.

This takes the role of both the librarian client and the LibraryFileAlias utility.

Method addFile See IFileUploadClient.
Method remoteAddFile See IFileUploadClient.
Method getURLForAlias See IFileDownloadClient.
Method getURLForAliasObject See IFileDownloadClient.
Method getFileByAlias See IFileDownloadClient.
Method pretendCommit Pretend that there's been a commit.
Method create See ILibraryFileAliasSet.
Method __getitem__ See ILibraryFileAliasSet.
Method findBySHA256 See ILibraryFileAliasSet.
Method beforeCompletion See ISynchronizer.
Method afterCompletion See ISynchronizer.
Method newTransaction See ISynchronizer.
Method _setUp Fixture API: install as the librarian.
Method _storeFile Like addFile, but returns the LibraryFileAlias.
Method _makeAlias Create a LibraryFileAlias.
Method _makeLibraryFileContent Create a LibraryFileContent.
def _setUp(self):
Fixture API: install as the librarian.
def addFile(self, name, size, file, contentType, expires=None):
See IFileUploadClient.
def _storeFile(self, name, size, file, contentType, expires=None):
Like addFile, but returns the LibraryFileAlias.
def remoteAddFile(self, name, size, file, contentType, expires=None):
See IFileUploadClient.
def getURLForAlias(self, aliasID, secure=False):
See IFileDownloadClient.
def getURLForAliasObject(self, alias):
See IFileDownloadClient.
def getFileByAlias(self, aliasID, timeout=LIBRARIAN_SERVER_DEFAULT_TIMEOUT):
See IFileDownloadClient.
def pretendCommit(self):
Pretend that there's been a commit.

When you add a file to the librarian (real or fake), it is not fully available until the transaction that added the file has been committed. Call this method to make the FakeLibrarian act as if there's been a commit, without actually committing a database transaction.

def _makeAlias(self, file_id, name, content, content_type):
Create a LibraryFileAlias.
def _makeLibraryFileContent(self, content):
Create a LibraryFileContent.
def create(self, name, size, file, contentType, expires=None, debugID=None, restricted=False, allow_zero_length=False):
See ILibraryFileAliasSet.
def __getitem__(self, key):
See ILibraryFileAliasSet.
def findBySHA256(self, sha256):
See ILibraryFileAliasSet.
def beforeCompletion(self, txn):
See ISynchronizer.
def afterCompletion(self, txn):
See ISynchronizer.
def newTransaction(self, txn):
See ISynchronizer.
API Documentation for Launchpad, generated by pydoctor at 2018-05-23 00:00:09.