~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/testing/fakelibrarian.py

Merge with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
        alias.checkCommitted()
152
152
        return StringIO(alias.content_string)
153
153
 
 
154
    def pretendCommit(self):
 
155
        """Pretend that there's been a commit.
 
156
 
 
157
        When you add a file to the librarian (real or fake), it is not
 
158
        fully available until the transaction that added the file has
 
159
        been committed.  Call this method to make the FakeLibrarian act
 
160
        as if there's been a commit, without actually committing a
 
161
        database transaction.
 
162
        """
 
163
        # Note that all files have been committed to storage.
 
164
        for alias in self.aliases.itervalues():
 
165
            alias.file_committed = True
 
166
 
154
167
    def _makeAlias(self, file_id, name, content, content_type):
155
168
        """Create a `LibraryFileAlias`."""
156
169
        alias = InstrumentedLibraryFileAlias(
195
208
 
196
209
    def afterCompletion(self, txn):
197
210
        """See `ISynchronizer`."""
198
 
        # Note that all files have been committed to storage.
199
 
        for alias in self.aliases.itervalues():
200
 
            alias.file_committed = True
 
211
        self.pretendCommit()
201
212
 
202
213
    def newTransaction(self, txn):
203
214
        """See `ISynchronizer`."""