summaryrefslogtreecommitdiffstats
path: root/tests/test_pages.py
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2017-02-14 20:23:58 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2017-02-15 11:22:12 (GMT)
commit0e99dbd0536d556f56cdc49ec5d0188a27edb02e (patch)
tree5fa97f1478fabc6f28e3c909f2b59e0aa16d2efc /tests/test_pages.py
parent39fead2b3de2fad0932cf0e90ccf6da90c0ea31a (diff)
downloadcombo-0e99dbd0536d556f56cdc49ec5d0188a27edb02e.zip
combo-0e99dbd0536d556f56cdc49ec5d0188a27edb02e.tar.gz
combo-0e99dbd0536d556f56cdc49ec5d0188a27edb02e.tar.bz2
misc: add method to get last update time of a page and its cells (#15001)
Diffstat (limited to 'tests/test_pages.py')
-rw-r--r--tests/test_pages.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_pages.py b/tests/test_pages.py
index 7c71acd..9b6c4ad 100644
--- a/tests/test_pages.py
+++ b/tests/test_pages.py
@@ -1,10 +1,12 @@
from StringIO import StringIO
+import datetime
import os
import pytest
import sys
from django.conf import settings
from django.contrib.auth.models import User, Group
+from django.utils.timezone import now
from combo.data.models import Page, CellBase, TextCell, LinkCell
from combo.data.management.commands.import_site import Command as ImportSiteCommand
from combo.data.management.commands.export_site import Command as ExportSiteCommand
@@ -245,3 +247,18 @@ def test_import_export_management_commands():
assert len(CellBase.get_cells(page_id=new_page_1.id)) == 1
assert isinstance(CellBase.get_cells(page_id=new_page_1.id)[0], TextCell)
assert CellBase.get_cells(page_id=new_page_1.id)[0].text == 'foo'
+
+def test_last_update_time():
+ page = Page(title=u'foo', slug='foo', order=0)
+ page.save()
+
+ cell = TextCell(page=page, text='foo', order=0)
+ cell.save()
+
+ cell = TextCell(page=page, text='bar', order=0)
+ cell.save()
+
+ future_time = now() + datetime.timedelta(days=2)
+ TextCell.objects.filter(pk=cell.id).update(last_update_timestamp=future_time)
+
+ assert page.get_last_update_time() == future_time