1
2
3
4
5
6
7
8
9
10
11
12
13
14 import time
15 import unittest
16
17 from trac.timeline.web_ui import TimelineModule
18 from trac.wiki.tests import formatter
19
20 TIMELINE_TEST_CASES = u"""
21 ============================== timeline: link resolver
22 timeline:2008-01-29
23 timeline:2008-01-29T15:48
24 timeline:2008-01-29T15:48Z
25 timeline:2008-01-29T16:48+01
26 timeline:2008-01-0A
27 timeline:@datestr_libc@
28 ------------------------------
29 <p>
30 <a class="timeline" href="/timeline?from=2008-01-29T00%3A00%3A00Z" title="See timeline at 2008-01-29T00:00:00Z">timeline:2008-01-29</a>
31 <a class="timeline" href="/timeline?from=2008-01-29T15%3A48%3A00Z&precision=minutes" title="See timeline at 2008-01-29T15:48:00Z">timeline:2008-01-29T15:48</a>
32 <a class="timeline" href="/timeline?from=2008-01-29T15%3A48%3A00Z&precision=minutes" title="See timeline at 2008-01-29T15:48:00Z">timeline:2008-01-29T15:48Z</a>
33 <a class="timeline" href="/timeline?from=2008-01-29T15%3A48%3A00Z&precision=seconds" title="See timeline at 2008-01-29T15:48:00Z">timeline:2008-01-29T16:48+01</a>
34 <a class="timeline missing" title=""2008-01-0A" is an invalid date, or the date format is not known. Try "YYYY-MM-DDThh:mm:ss±hh:mm" instead.">timeline:2008-01-0A</a>
35 <a class="timeline missing" title=""@datestr_libc@" is an invalid date, or the date format is not known. Try "YYYY-MM-DDThh:mm:ss±hh:mm" instead.">timeline:@datestr_libc@</a>
36 </p>
37 ------------------------------
38 """
39
40
42 suite = unittest.TestSuite()
43 datestr_libc = time.strftime('%x', (2013, 10, 24, 0, 0, 0, 0, 0, -1))
44 suite.addTest(formatter.suite(TIMELINE_TEST_CASES.replace('@datestr_libc@',
45 datestr_libc),
46 file=__file__))
47 return suite
48
49 if __name__ == '__main__':
50 unittest.main(defaultTest='suite')
51