|
@@ -1,5 +1,6 @@
|
1
|
1
|
# -*- coding: utf-8 -*-
|
2
|
|
-from nose.tools import raises
|
|
2
|
+import time
|
|
3
|
+from nose.tools import raises, ok_
|
3
|
4
|
from sqlalchemy.sql.elements import and_
|
4
|
5
|
from sqlalchemy.testing import eq_
|
5
|
6
|
|
|
@@ -63,6 +64,7 @@ class TestContent(TestStandard):
|
63
|
64
|
eq_(1, DBSession.query(ContentRevisionRO).filter(ContentRevisionRO.label == 'TEST_CONTENT_1').count())
|
64
|
65
|
|
65
|
66
|
with new_revision(content):
|
|
67
|
+ time.sleep(0.00001)
|
66
|
68
|
content.description = 'TEST_CONTENT_DESCRIPTION_1_UPDATED'
|
67
|
69
|
DBSession.flush()
|
68
|
70
|
|
|
@@ -70,6 +72,7 @@ class TestContent(TestStandard):
|
70
|
72
|
eq_(1, DBSession.query(Content).filter(Content.id == created_content.id).count())
|
71
|
73
|
|
72
|
74
|
with new_revision(content):
|
|
75
|
+ time.sleep(0.00001)
|
73
|
76
|
content.description = 'TEST_CONTENT_DESCRIPTION_1_UPDATED_2'
|
74
|
77
|
content.label = 'TEST_CONTENT_1_UPDATED_2'
|
75
|
78
|
DBSession.flush()
|
|
@@ -77,6 +80,17 @@ class TestContent(TestStandard):
|
77
|
80
|
eq_(1, DBSession.query(ContentRevisionRO).filter(ContentRevisionRO.label == 'TEST_CONTENT_1_UPDATED_2').count())
|
78
|
81
|
eq_(1, DBSession.query(Content).filter(Content.id == created_content.id).count())
|
79
|
82
|
|
|
83
|
+ revision_1 = DBSession.query(ContentRevisionRO)\
|
|
84
|
+ .filter(ContentRevisionRO.description == 'TEST_CONTENT_DESCRIPTION_1').one()
|
|
85
|
+ revision_2 = DBSession.query(ContentRevisionRO)\
|
|
86
|
+ .filter(ContentRevisionRO.description == 'TEST_CONTENT_DESCRIPTION_1_UPDATED').one()
|
|
87
|
+ revision_3 = DBSession.query(ContentRevisionRO)\
|
|
88
|
+ .filter(ContentRevisionRO.description == 'TEST_CONTENT_DESCRIPTION_1_UPDATED_2').one()
|
|
89
|
+
|
|
90
|
+ # Updated dates must be different
|
|
91
|
+ ok_(revision_1.updated < revision_2.updated < revision_3.updated)
|
|
92
|
+ ok_(revision_1.created < revision_2.created < revision_3.created)
|
|
93
|
+
|
80
|
94
|
def test_creates(self):
|
81
|
95
|
eq_(0, DBSession.query(ContentRevisionRO).filter(ContentRevisionRO.label == 'TEST_CONTENT_1').count())
|
82
|
96
|
eq_(0, DBSession.query(Workspace).filter(Workspace.label == 'TEST_WORKSPACE_1').count())
|