~madjar/wikkid/plugin

« back to all changes in this revision

Viewing changes to wikkid/tests/filestore.py

Show who last modified the file and when on the normal wiki page - Martin Albisetti.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
"""The base test class for filestores."""
8
8
 
 
9
from datetime import datetime
 
10
 
9
11
from wikkid.errors import FileExists
10
12
from wikkid.interface.filestore import FileType, IFile, IFileStore
11
13
 
151
153
        self.assertEqual(
152
154
            ['another', 'subfile'],
153
155
            sorted(f.base_name for f in listing))
 
156
 
 
157
    def test_last_modified(self):
 
158
        # Make sure that the timestamp and author are recorded.
 
159
        start = datetime.utcnow()
 
160
        filestore = self.make_filestore()
 
161
        filestore.update_file(
 
162
            'new-file.txt',
 
163
            'some content',
 
164
            'Test Author <test@example.com>',
 
165
            None)
 
166
        curr = filestore.get_file('new-file.txt')
 
167
        end = datetime.utcnow()
 
168
        # A new line is added to the end too.
 
169
        self.assertEqual(
 
170
            'Test Author <test@example.com>',
 
171
            curr.last_modified_by)
 
172
 
 
173
        self.assertTrue(start <= curr.last_modified_date <= end)