|
a/Allura/allura/tests/model/test_discussion.py |
|
b/Allura/allura/tests/model/test_discussion.py |
|
... |
|
... |
60 |
assert t.discussion_class() == M.Discussion
|
60 |
assert t.discussion_class() == M.Discussion
|
61 |
assert t.post_class() == M.Post
|
61 |
assert t.post_class() == M.Post
|
62 |
assert t.attachment_class() == M.DiscussionAttachment
|
62 |
assert t.attachment_class() == M.DiscussionAttachment
|
63 |
p0 = t.post('This is a post')
|
63 |
p0 = t.post('This is a post')
|
64 |
p1 = t.post('This is another post')
|
64 |
p1 = t.post('This is another post')
|
65 |
time.sleep(1)
|
65 |
time.sleep(0.25)
|
66 |
p2 = t.post('This is a reply', parent_id=p0._id)
|
66 |
p2 = t.post('This is a reply', parent_id=p0._id)
|
67 |
ThreadLocalORMSession.flush_all()
|
67 |
ThreadLocalORMSession.flush_all()
|
68 |
ThreadLocalORMSession.close_all()
|
68 |
ThreadLocalORMSession.close_all()
|
69 |
d = M.Discussion.query.get(shortname='test')
|
69 |
d = M.Discussion.query.get(shortname='test')
|
70 |
t = d.threads[0]
|
70 |
t = d.threads[0]
|
|
... |
|
... |
72 |
assert t.last_post is not None
|
72 |
assert t.last_post is not None
|
73 |
t.create_post_threads(t.posts)
|
73 |
t.create_post_threads(t.posts)
|
74 |
posts0 = t.find_posts(page=0, limit=10, style='threaded')
|
74 |
posts0 = t.find_posts(page=0, limit=10, style='threaded')
|
75 |
posts1 = t.find_posts(page=0, limit=10, style='timestamp')
|
75 |
posts1 = t.find_posts(page=0, limit=10, style='timestamp')
|
76 |
assert posts0 != posts1
|
76 |
assert posts0 != posts1
|
|
|
77 |
ts = p0.timestamp.replace(
|
|
|
78 |
microsecond=int(p0.timestamp.microsecond // 1000) * 1000)
|
77 |
posts2 = t.find_posts(page=0, limit=10, style='threaded', timestamp=p0.timestamp)
|
79 |
posts2 = t.find_posts(page=0, limit=10, style='threaded', timestamp=ts)
|
78 |
assert len(posts2) > 0
|
80 |
assert len(posts2) > 0
|
79 |
|
81 |
|
80 |
assert 'wiki/_discuss/' in t.url()
|
82 |
assert 'wiki/_discuss/' in t.url()
|
81 |
assert t.index()['views_i'] == 0
|
83 |
assert t.index()['views_i'] == 0
|
82 |
assert not t.subscription
|
84 |
assert not t.subscription
|