Package trac :: Package wiki :: Package tests :: Module macros

Source Code for Module trac.wiki.tests.macros

  1  # -*- coding: utf-8 -*- 
  2  # 
  3  # Copyright (C) 2006-2020 Edgewall Software 
  4  # All rights reserved. 
  5  # 
  6  # This software is licensed as described in the file COPYING, which 
  7  # you should have received as part of this distribution. The terms 
  8  # are also available at https://trac.edgewall.org/wiki/TracLicense. 
  9  # 
 10  # This software consists of voluntary contributions made by many 
 11  # individuals. For the exact contribution history, see the revision 
 12  # history and logs, available at https://trac.edgewall.org/log/. 
 13   
 14  from StringIO import StringIO 
 15  import os 
 16  import tempfile 
 17  import unittest 
 18   
 19  from trac.attachment import Attachment 
 20  from trac.config import BoolOption, ConfigSection, IntOption, ListOption, \ 
 21                          Option 
 22  from trac.test import locale_en, rmtree 
 23  from trac.util.datefmt import datetime_now, format_date, utc 
 24  from trac.wiki.model import WikiPage 
 25  from trac.wiki.tests import formatter 
 26   
 27   
28 -def add_pages(tc, names):
29 now = datetime_now(utc) 30 for name in names: 31 w = WikiPage(tc.env) 32 w.name = name 33 w.text = '--' 34 w.save('joe', 'the page ' + name, '::1', now)
35 36
37 -def add_attachment(tc, realm, id, file):
38 attachment = Attachment(tc.env, realm, id) 39 attachment.description = "image in %s" % id 40 attachment.insert(file, StringIO(''), 0, 2)
41 42 43 # == [[Image]] 44
45 -def image_setup(tc):
46 add_pages(tc, ['page:fr', 'page']) 47 tc.env.path = tempfile.mkdtemp(prefix='trac-tempenv-') 48 add_attachment(tc, 'wiki', 'page:fr', 'img.png') 49 add_attachment(tc, 'wiki', 'page', 'img.png') 50 add_attachment(tc, 'wiki', 'page', '][img.png') 51 tc.env.config.set('interwiki', 'shields', 'https://img.shields.io/') 52 tc.env.config.set('interwiki', 'travis', 53 'https://travis-ci.org/$1?branch=$2') 54 htdocs_location = 'http://assets.example.org/common' 55 tc.context.req.chrome['htdocs_location'] = htdocs_location 56 tc.env.config.set('trac', 'htdocs_location', htdocs_location)
57
58 -def image_teardown(tc):
59 rmtree(os.path.join(tc.env.path, 'files')) 60 os.rmdir(tc.env.path) # there was only 'files' below tc.env.path 61 tc.env.reset_db()
62 63 # Note: using `« test »` string in the following tests for checking 64 # unicode robustness and whitespace support (first space is 65 # normal ASCII SPACE, second is Unicode NO-BREAK SPACE). 66 67 IMAGE_MACRO_TEST_CASES = u""" 68 ============================== Image, no arguments 69 [[Image]] 70 ------------------------------ 71 72 ============================== Image, no arguments 73 [[Image()]] 74 ------------------------------ 75 76 ============================== Image, multiple no arguments 77 [[Image(,)]] 78 ------------------------------ 79 80 ============================== Image, whitespace argument 81 [[Image( )]] 82 ------------------------------ 83 84 ============================== Image, ZWSP argument 85 [[Image(​)]] 86 ------------------------------ 87 88 ============================== source: Image, no other arguments 89 [[Image(source:« test ».png)]] 90 ------------------------------ 91 <p> 92 <a style="padding:0; border:none" href="/browser/%C2%AB%20test%C2%A0%C2%BB.png"><img src="/browser/%C2%AB%20test%C2%A0%C2%BB.png?format=raw" alt="source:« test ».png" title="source:« test ».png" /></a> 93 </p> 94 ------------------------------ 95 [[Image(...)]] 96 ============================== source: Image, inline 97 [[Image(source:« test ».png, inline)]] 98 ------------------------------ 99 <p> 100 <a style="padding:0; border:none" href="/browser/%C2%AB%20test%C2%A0%C2%BB.png"><img src="/browser/%C2%AB%20test%C2%A0%C2%BB.png?format=raw" alt="source:« test ».png" title="source:« test ».png" /></a> 101 </p> 102 ------------------------------ 103 <a style="padding:0; border:none" href="/browser/%C2%AB%20test%C2%A0%C2%BB.png"><img src="/browser/%C2%AB%20test%C2%A0%C2%BB.png?format=raw" alt="source:« test ».png" title="source:« test ».png" /></a> 104 ============================== intertrac:source: Image, no other arguments 105 [[Image(trac:source:/trunk/doc/images/bkgnd_pattern_« test ».png)]] 106 ------------------------------ 107 <p> 108 <a style="padding:0; border:none" href="https://trac.edgewall.org/intertrac/source%3A/trunk/doc/images/bkgnd_pattern_%C2%AB%20test%C2%A0%C2%BB.png"><img src="https://trac.edgewall.org/intertrac/source%3A/trunk/doc/images/bkgnd_pattern_%C2%AB%20test%C2%A0%C2%BB.png%3Fformat%3Draw" alt="source:/trunk/doc/images/bkgnd_pattern_« test ».png in The Trac Project" crossorigin="anonymous" title="source:/trunk/doc/images/bkgnd_pattern_« test ».png in The Trac Project" /></a> 109 </p> 110 ============================== source: Image, nolink 111 [[Image(source:« test », nolink)]] 112 ------------------------------ 113 <p> 114 <img src="/browser/%C2%AB%20test%C2%A0%C2%BB?format=raw" alt="source:« test »" title="source:« test »" /> 115 </p> 116 ============================== source: Image, normal args 117 [[Image(source:« test », align=left, title=Test)]] 118 ------------------------------ 119 <p> 120 <a style="padding:0; border:none" href="/browser/%C2%AB%20test%C2%A0%C2%BB"><img src="/browser/%C2%AB%20test%C2%A0%C2%BB?format=raw" alt="source:« test »" style="float:left" title="Test" /></a> 121 </p> 122 ============================== source: Image, size arg 123 [[Image(source:« test », 30%)]] 124 ------------------------------ 125 <p> 126 <a style="padding:0; border:none" href="/browser/%C2%AB%20test%C2%A0%C2%BB"><img width="30%" alt="source:« test »" title="source:« test »" src="/browser/%C2%AB%20test%C2%A0%C2%BB?format=raw" /></a> 127 </p> 128 ============================== source: Image, keyword alignment 129 [[Image(source:« test », right)]] 130 ------------------------------ 131 <p> 132 <a style="padding:0; border:none" href="/browser/%C2%AB%20test%C2%A0%C2%BB"><img src="/browser/%C2%AB%20test%C2%A0%C2%BB?format=raw" alt="source:« test »" style="float:right" title="source:« test »" /></a> 133 </p> 134 ============================== http: Image, nolink 135 [[Image(http://www.edgewall.com/gfx/shredder_« test ».png, nolink)]] 136 ------------------------------ 137 <p> 138 <img src="http://www.edgewall.com/gfx/shredder_« test ».png" alt="http://www.edgewall.com/gfx/shredder_« test ».png" crossorigin="anonymous" title="http://www.edgewall.com/gfx/shredder_« test ».png" /> 139 </p> 140 ============================== http: Image, absolute, many ':' 141 [[Image(http://chart.apis.google.com:80/chart?cht=p3&chd=s:hW&chs=250x100&chl=Héllo|Wôrld, title=Google & Charting, link=)]] 142 ------------------------------ 143 <p> 144 <img src="http://chart.apis.google.com:80/chart?cht=p3&amp;chd=s:hW&amp;chs=250x100&amp;chl=Héllo|Wôrld" alt="http://chart.apis.google.com:80/chart" crossorigin="anonymous" title="Google &amp; Charting" /> 145 </p> 146 ============================== // Image, server-relative 147 [[Image(//browser/« test »?format=raw, link=)]] 148 ------------------------------ 149 <p> 150 <img src="/browser/« test »?format=raw" alt="/browser/« test »" title="/browser/« test »" /> 151 </p> 152 ============================== / Image, project-relative, link to WikiStart 153 [[Image(/browser/« test »?format=raw, link=wiki:WikiStart)]] 154 ------------------------------ 155 <p> 156 <a style="padding:0; border:none" href="/wiki/WikiStart"><img src="/browser/%C2%AB%20test%C2%A0%C2%BB?format=raw" alt="/browser/« test »" title="/browser/« test »" /></a> 157 </p> 158 ============================== Strip unicode white-spaces and ZWSPs (#10668) 159 [[Image(  ​source:« test ».png  ​, nolink, 100%  ​)]] 160 ------------------------------ 161 <p> 162 <img width="100%" alt="source:« test ».png" title="source:« test ».png" src="/browser/%C2%AB%20test%C2%A0%C2%BB.png?format=raw" /> 163 </p> 164 ============================== Attachments on page with ':' characters (#10562) 165 [[Image("page:fr":img.png​,nolink)]] 166 ------------------------------ 167 <p> 168 <img src="/raw-attachment/wiki/page%3Afr/img.png" alt="image in page:fr" title="image in page:fr" /> 169 </p> 170 ============================== htdocs: Image, nolink 171 [[Image(htdocs:trac_logo.png, nolink)]] 172 ------------------------------ 173 <p> 174 <img src="/chrome/site/trac_logo.png" alt="trac_logo.png" title="trac_logo.png" /> 175 </p> 176 ============================== shared: Image, nolink 177 [[Image(shared:trac_logo.png, nolink)]] 178 ------------------------------ 179 <p> 180 <img src="/chrome/shared/trac_logo.png" alt="trac_logo.png" title="trac_logo.png" /> 181 </p> 182 ============================== 183 [[Image("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAQMAAAC2MCouAAAAA1BMVEXLQ0MOAUiXAAAAC0lEQVQIHWMYYQAAAPAAASEIRrcAAAAASUVORK5CYII=")]] 184 ------------------------------ 185 <p> 186 <a style="padding:0; border:none" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAQMAAAC2MCouAAAAA1BMVEXLQ0MOAUiXAAAAC0lEQVQIHWMYYQAAAPAAASEIRrcAAAAASUVORK5CYII="><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAQMAAAC2MCouAAAAA1BMVEXLQ0MOAUiXAAAAC0lEQVQIHWMYYQAAAPAAASEIRrcAAAAASUVORK5CYII=" alt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAQMAAAC2MCouAAAAA1BMVEXLQ0MOAUiXAAAAC0lEQVQIHWMYYQAAAPAAASEIRrcAAAAASUVORK5CYII=" title="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAQMAAAC2MCouAAAAA1BMVEXLQ0MOAUiXAAAAC0lEQVQIHWMYYQAAAPAAASEIRrcAAAAASUVORK5CYII=" /></a> 187 </p> 188 ============================== 189 [[Image("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAQMAAAC2MCouAAAAA1BMVEXLQ0MOAUiXAAAAC0lEQVQIHWMYYQAAAPAAASEIRrcAAAAASUVORK5CYII=", nolink)]] 190 ------------------------------ 191 <p> 192 <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAQMAAAC2MCouAAAAA1BMVEXLQ0MOAUiXAAAAC0lEQVQIHWMYYQAAAPAAASEIRrcAAAAASUVORK5CYII=" alt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAQMAAAC2MCouAAAAA1BMVEXLQ0MOAUiXAAAAC0lEQVQIHWMYYQAAAPAAASEIRrcAAAAASUVORK5CYII=" title="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAQMAAAC2MCouAAAAA1BMVEXLQ0MOAUiXAAAAC0lEQVQIHWMYYQAAAPAAASEIRrcAAAAASUVORK5CYII=" /> 193 </p> 194 ============================== InterWiki 195 [[Image(shields:travis/edgewall/trac.svg, link=trac:source:/trunk)]] 196 [[Image(travis:edgewall/trac.svg:1.0-stable, link=trac:source:/branches/1.0-stable)]] 197 ------------------------------ 198 <p> 199 <a style="padding:0; border:none" href="https://trac.edgewall.org/intertrac/source%3A/trunk"><img src="https://img.shields.io/travis/edgewall/trac.svg" alt="travis/edgewall/trac.svg in shields" crossorigin="anonymous" title="travis/edgewall/trac.svg in shields" /></a> 200 <a style="padding:0; border:none" href="https://trac.edgewall.org/intertrac/source%3A/branches/1.0-stable"><img src="https://travis-ci.org/edgewall/trac.svg?branch=1.0-stable" alt="edgewall/trac.svg:1.0-stable in travis" crossorigin="anonymous" title="edgewall/trac.svg:1.0-stable in travis" /></a> 201 </p> 202 ============================== InterWiki, nolink 203 [[Image(shields:pypi/dm/trac.svg, nolink)]] 204 ------------------------------ 205 <p> 206 <img src="https://img.shields.io/pypi/dm/trac.svg" alt="pypi/dm/trac.svg in shields" crossorigin="anonymous" title="pypi/dm/trac.svg in shields" /> 207 </p> 208 ============================== 209 [[Image(notfound.png, nolink)]] 210 ------------------------------ 211 <p> 212 <img src="http://assets.example.org/common/attachment.png" alt="No image &#34;notfound.png&#34; attached to WikiStart" crossorigin="anonymous" title="No image &#34;notfound.png&#34; attached to WikiStart" /> 213 </p> 214 ============================== 215 [[Image(img.png, margin-bottom=-1)]] 216 ------------------------------ 217 <p> 218 <img src="http://assets.example.org/common/attachment.png" alt="No image &#34;img.png&#34; attached to WikiStart" title="No image &#34;img.png&#34; attached to WikiStart" style="margin-bottom: 1px" crossorigin="anonymous" /> 219 </p> 220 ============================== 221 [[Image(img.png, margin-bottom=--)]] 222 ------------------------------ 223 <p> 224 <div class="system-message"><strong>Macro Image(img.png, margin-bottom=--) failed</strong><pre>Invalid macro argument <code>margin-bottom=--</code></pre></div> 225 </p> 226 ============================== 227 [[Image(img.png, margin-top=--)]] 228 ------------------------------ 229 <p> 230 <div class="system-message"><strong>Macro Image(img.png, margin-top=--) failed</strong><pre>Invalid macro argument <code>margin-top=--</code></pre></div> 231 </p> 232 ============================== 233 [[Image(img.png, margin=--)]] 234 ------------------------------ 235 <p> 236 <div class="system-message"><strong>Macro Image(img.png, margin=--) failed</strong><pre>Invalid macro argument <code>margin=--</code></pre></div> 237 </p> 238 ============================== 239 [[Image(img.png, margin-left=--)]] 240 ------------------------------ 241 <p> 242 <div class="system-message"><strong>Macro Image(img.png, margin-left=--) failed</strong><pre>Invalid macro argument <code>margin-left=--</code></pre></div> 243 </p> 244 ============================== 245 [[Image(img.png, margin-right=--)]] 246 ------------------------------ 247 <p> 248 <div class="system-message"><strong>Macro Image(img.png, margin-right=--) failed</strong><pre>Invalid macro argument <code>margin-right=--</code></pre></div> 249 </p> 250 ============================== 251 [[Image(img.png, border=--)]] 252 ------------------------------ 253 <p> 254 <div class="system-message"><strong>Macro Image(img.png, border=--) failed</strong><pre>Invalid macro argument <code>border=--</code></pre></div> 255 </p> 256 ============================== # Regression test for #12333 257 = [[Image]] 258 ------------------------------ 259 <h1 id="Image">[[Image]]</h1> 260 ============================== Invalid use of attachment TracLink 261 [[Image(attachment:img.png:wiki:page)]] 262 ------------------------------ 263 <p> 264 </p><div class="system-message"><strong>No filespec given</strong></div><p> 265 </p> 266 ============================== Non-existent attachment 267 [[Image(wiki:page:img2.png)]] 268 ------------------------------ 269 <p> 270 <img src="http://assets.example.org/common/attachment.png" alt="No image &#34;img2.png&#34; attached to page" crossorigin="anonymous" title="No image &#34;img2.png&#34; attached to page" /> 271 </p> 272 ============================== "[" and "]" characters - 1 (#12762) 273 [[Image(wiki:page:][img.png,nolink)]] 274 ------------------------------ 275 <p> 276 <img src="/raw-attachment/wiki/page/%5D%5Bimg.png" alt="image in page" title="image in page" /> 277 </p> 278 ============================== "[" and "]" characters - 2 (#12762) 279 [[Image(][img.png,nolink)]] 280 ------------------------------ 281 <p> 282 <img src="http://assets.example.org/common/attachment.png" alt="No image &#34;][img.png&#34; attached to WikiStart" crossorigin="anonymous" title="No image &#34;][img.png&#34; attached to WikiStart" /> 283 </p> 284 """ 285 286 # Note: in the <img> src attribute above, the Unicode characters 287 # within the URI sometimes come out as %-encoded, sometimes raw 288 # (server-relative case). Both forms are valid (at least 289 # according to the W3C XHTML validator). 290 291 292 # == [[InterTrac]] 293
294 -def intertrac_setup(tc):
295 tc.env.config.set('intertrac', 'example', 'example2') 296 # Definition conflict with alias, but must not raise a TypeError. 297 tc.env.config.set('intertrac', 'example.url', 'http://example.org')
298 299 300 INTERTRAC_MACRO_TEST_CASES = u"""\ 301 ============================== 302 [[InterTrac]] 303 ------------------------------ 304 <p> 305 </p><table class="wiki intertrac"><tr><th><em>Prefix</em></th><th><em>Trac Site</em></th></tr><tr><td><strong>example</strong></td><td>Alias for <strong>example2</strong></td></tr><tr><td><a href="https://genshi.edgewall.org/timeline"><strong>genshi</strong></a></td><td><a href="https://genshi.edgewall.org">Genshi\'s Trac</a></td></tr><tr><td><strong>t</strong></td><td>Alias for <strong>trac</strong></td></tr><tr><td><a href="http://trac-hacks.org/timeline"><strong>th</strong></a></td><td><a href="http://trac-hacks.org">Trac Hacks</a></td></tr><tr><td><a href="https://trac.edgewall.org/timeline"><strong>trac</strong></a></td><td><a href="https://trac.edgewall.org">The Trac Project</a></td></tr></table><p> 306 </p> 307 """ 308 309 310 # == [[TitleIndex]] 311
312 -def titleindex_teardown(tc):
313 tc.env.reset_db()
314 315 316 317 TITLEINDEX1_MACRO_TEST_CASES = u""" 318 ============================== TitleIndex, default format 319 [[TitleIndex()]] 320 ------------------------------ 321 <p> 322 </p><div class="titleindex"><ul><li><a href="/wiki/WikiStart">WikiStart</a></li></ul></div><p> 323 </p> 324 ------------------------------ 325 [[TitleIndex]] 326 ============================== TitleIndex, compact format 327 [[TitleIndex(format=compact)]] 328 ------------------------------ 329 <p> 330 <a href="/wiki/WikiStart">WikiStart</a> 331 </p> 332 ------------------------------ 333 [[TitleIndex(...)]] 334 ============================== 335 [[TitleIndex(min=--)]] 336 ------------------------------ 337 <p> 338 <div class="system-message"><strong>Macro TitleIndex(min=--) failed</strong><pre>Invalid macro argument <code>min=--</code></pre></div> 339 </p> 340 ============================== 341 [[TitleIndex(depth=--)]] 342 ------------------------------ 343 <p> 344 <div class="system-message"><strong>Macro TitleIndex(depth=--) failed</strong><pre>Invalid macro argument <code>depth=--</code></pre></div> 345 </p> 346 ------------------------------ 347 """ 348 349 TITLEINDEX2_MACRO_TEST_CASES = u""" 350 ============================== TitleIndex, default format 351 [[TitleIndex()]] 352 ------------------------------ 353 <p> 354 </p><div class="titleindex"><ul><li><a href="/wiki/WikiEnd">WikiEnd</a></li><li><a href="/wiki/WikiStart">WikiStart</a></li></ul></div><p> 355 </p> 356 ------------------------------ 357 [[TitleIndex]] 358 ============================== TitleIndex, compact format 359 [[TitleIndex(format=compact)]] 360 ------------------------------ 361 <p> 362 <a href="/wiki/WikiEnd">WikiEnd</a>, <a href="/wiki/WikiStart">WikiStart</a> 363 </p> 364 ------------------------------ 365 [[TitleIndex(...)]] 366 ============================== TitleIndex, default format with prefix 367 [[TitleIndex(Wiki)]] 368 ------------------------------ 369 <p> 370 </p><div class="titleindex"><ul><li><a href="/wiki/WikiEnd">WikiEnd</a></li><li><a href="/wiki/WikiStart">WikiStart</a></li></ul></div><p> 371 </p> 372 ------------------------------ 373 [[TitleIndex(...)]] 374 ============================== TitleIndex, compact format with prefix 375 [[TitleIndex(Wiki,format=compact)]] 376 ------------------------------ 377 <p> 378 <a href="/wiki/WikiEnd">WikiEnd</a>, <a href="/wiki/WikiStart">WikiStart</a> 379 </p> 380 ------------------------------ 381 [[TitleIndex(...)]] 382 ============================== TitleIndex, default format with prefix hidden 383 [[TitleIndex(Wiki,hideprefix)]] 384 ------------------------------ 385 <p> 386 </p><div class="titleindex"><ul><li><a href="/wiki/WikiEnd">End</a></li><li><a href="/wiki/WikiStart">Start</a></li></ul></div><p> 387 </p> 388 ------------------------------ 389 [[TitleIndex(...)]] 390 ============================== TitleIndex, compact format with prefix hidden 391 [[TitleIndex(Wiki,hideprefix,format=compact)]] 392 ------------------------------ 393 <p> 394 <a href="/wiki/WikiEnd">End</a>, <a href="/wiki/WikiStart">Start</a> 395 </p> 396 ------------------------------ 397 [[TitleIndex(...)]] 398 """ 399
400 -def titleindex2_setup(tc):
401 add_pages(tc, ['WikiEnd'])
402 403 404 TITLEINDEX3_MACRO_TEST_CASES = u""" 405 ============================== TitleIndex, group format 406 [[TitleIndex(Wiki,format=group)]] 407 ------------------------------ 408 <p> 409 </p><div class="titleindex"><ul><li><strong>Wiki</strong><ul><li><strong>End</strong><ul><li><a href="/wiki/WikiEnd/First">WikiEnd/First</a></li><li><a href="/wiki/WikiEnd/Second">WikiEnd/Second</a></li></ul></li><li><strong>Start</strong><ul><li><a href="/wiki/WikiStart">WikiStart</a></li><li><a href="/wiki/WikiStart/First">WikiStart/First</a></li><li><a href="/wiki/WikiStart/Second">WikiStart/Second</a></li><li><a href="/wiki/WikiStart/Third">WikiStart/Third</a></li></ul></li></ul></li></ul></div><p> 410 </p> 411 ------------------------------ 412 ============================== TitleIndex, hierarchy format 413 [[TitleIndex(WikiStart/, format=hierarchy)]] 414 ------------------------------ 415 <p> 416 </p><div class="titleindex"><ul><li>WikiStart<ul><li><a href="/wiki/WikiStart/First">First</a></li><li><a href="/wiki/WikiStart/Second">Second</a></li><li><a href="/wiki/WikiStart/Third">Third</a></li></ul></li></ul></div><p> 417 </p> 418 ------------------------------ 419 ============================== TitleIndex, group format, prefix hidden 420 [[TitleIndex(Wiki,hideprefix,format=group)]] 421 ------------------------------ 422 <p> 423 </p><div class="titleindex"><ul><li><strong>End</strong><ul><li><a href="/wiki/WikiEnd/First">End/First</a></li><li><a href="/wiki/WikiEnd/Second">End/Second</a></li></ul></li><li><strong>Start</strong><ul><li><a href="/wiki/WikiStart">Start</a></li><li><a href="/wiki/WikiStart/First">Start/First</a></li><li><a href="/wiki/WikiStart/Second">Start/Second</a></li><li><a href="/wiki/WikiStart/Third">Start/Third</a></li></ul></li></ul></div><p> 424 </p> 425 ------------------------------ 426 ============================== TitleIndex, hierarchy format, prefix hidden 427 [[TitleIndex(WikiStart/,hideprefix,format=hierarchy)]] 428 ------------------------------ 429 <p> 430 </p><div class="titleindex"><ul><li><a href="/wiki/WikiStart/First">First</a></li><li><a href="/wiki/WikiStart/Second">Second</a></li><li><a href="/wiki/WikiStart/Third">Third</a></li></ul></div><p> 431 </p> 432 ------------------------------ 433 ============================== TitleIndex, relative prefix 434 [[TitleIndex(../../WikiStart)]] 435 ------------------------------ 436 <p> 437 </p><div class="titleindex"><ul><li><a href="/wiki/WikiStart">WikiStart</a></li><li><a href="/wiki/WikiStart/First">WikiStart/First</a></li><li><a href="/wiki/WikiStart/Second">WikiStart/Second</a></li><li><a href="/wiki/WikiStart/Third">WikiStart/Third</a></li></ul></div><p> 438 </p> 439 ------------------------------ 440 ============================== TitleIndex, relative prefix with trailing slash 441 [[TitleIndex(../../WikiStart/)]] 442 ------------------------------ 443 <p> 444 </p><div class="titleindex"><ul><li><a href="/wiki/WikiStart/First">WikiStart/First</a></li><li><a href="/wiki/WikiStart/Second">WikiStart/Second</a></li><li><a href="/wiki/WikiStart/Third">WikiStart/Third</a></li></ul></div><p> 445 </p> 446 ------------------------------ 447 ============================== TitleIndex, relative prefix .. 448 [[TitleIndex(..)]] 449 ------------------------------ 450 <p> 451 </p><div class="titleindex"><ul><li><a href="/wiki/WikiStart">WikiStart</a></li><li><a href="/wiki/WikiStart/First">WikiStart/First</a></li><li><a href="/wiki/WikiStart/Second">WikiStart/Second</a></li><li><a href="/wiki/WikiStart/Third">WikiStart/Third</a></li></ul></div><p> 452 </p> 453 ------------------------------ 454 ============================== TitleIndex, relative prefix ../ 455 [[TitleIndex(../)]] 456 ------------------------------ 457 <p> 458 </p><div class="titleindex"><ul><li><a href="/wiki/WikiStart/First">WikiStart/First</a></li><li><a href="/wiki/WikiStart/Second">WikiStart/Second</a></li><li><a href="/wiki/WikiStart/Third">WikiStart/Third</a></li></ul></div><p> 459 </p> 460 ------------------------------ 461 ============================== TitleIndex, relative prefix . 462 [[TitleIndex(.)]] 463 ------------------------------ 464 <p> 465 </p><div class="titleindex"><ul><li><a href="/wiki/WikiStart/Second">WikiStart/Second</a></li></ul></div><p> 466 </p> 467 ------------------------------ 468 ============================== TitleIndex, relative prefix ./ 469 [[TitleIndex(./)]] 470 ------------------------------ 471 <p> 472 </p><div class="titleindex"><ul></ul></div><p> 473 </p> 474 ------------------------------ 475 ============================== TitleIndex, relative hidden prefix ../ 476 [[TitleIndex(../,hideprefix)]] 477 ------------------------------ 478 <p> 479 </p><div class="titleindex"><ul><li><a href="/wiki/WikiStart/First">First</a></li><li><a href="/wiki/WikiStart/Second">Second</a></li><li><a href="/wiki/WikiStart/Third">Third</a></li></ul></div><p> 480 </p> 481 ------------------------------ 482 ============================== TitleIndex, top-level pages only 483 [[TitleIndex(depth=0)]] 484 ------------------------------ 485 <p> 486 </p><div class="titleindex"><ul><li><a href="/wiki/WikiStart">WikiStart</a></li></ul></div><p> 487 </p> 488 ------------------------------ 489 """ 490
491 -def titleindex3_setup(tc):
492 add_pages(tc, [ 493 'WikiStart/First', 494 'WikiStart/Second', 495 'WikiStart/Third', 496 'WikiEnd/First', 497 'WikiEnd/Second', 498 ])
499 500 501 TITLEINDEX4_MACRO_TEST_CASES = u""" 502 ============================== TitleIndex group and page with numbers (#7919) 503 [[TitleIndex(format=group)]] 504 ------------------------------ 505 <p> 506 </p><div class="titleindex"><ul><li><strong>0.11</strong><ul><li><strong>Group</strong><ul><li><a href="/wiki/0.11/GroupOne">0.11/GroupOne</a></li><li><a href="/wiki/0.11/GroupTwo">0.11/GroupTwo</a></li></ul></li><li><a href="/wiki/0.11/Test">0.11/Test</a></li></ul></li><li><strong>Test</strong><ul><li><strong>0.11</strong><ul><li><a href="/wiki/Test0.11/Abc">Test0.11/Abc</a></li><li><a href="/wiki/Test0.11Abc">Test0.11Abc</a></li></ul></li><li><strong>0.12</strong><ul><li><a href="/wiki/Test0.12Def">Test0.12Def</a></li><li><a href="/wiki/Test0.12Ijk">Test0.12Ijk</a></li></ul></li><li><strong>0.13</strong><ul><li><a href="/wiki/Test0.13alpha">Test0.13alpha</a></li><li><a href="/wiki/Test0.13beta">Test0.13beta</a></li></ul></li><li><a href="/wiki/Test0.131">Test0.131</a></li><li><a href="/wiki/Test2">Test2</a></li><li><a href="/wiki/TestTest">TestTest</a></li><li><a href="/wiki/TestThing">TestThing</a></li></ul></li><li><a href="/wiki/WikiStart">WikiStart</a></li></ul></div><p> 507 </p> 508 ------------------------------ 509 ============================== TitleIndex, compact format with prefix hidden, including Test0.13* 510 [[TitleIndex(Test,format=compact,include=*0.13*)]] 511 ------------------------------ 512 <p> 513 <a href="/wiki/Test0.131">Test0.131</a>, <a href="/wiki/Test0.13alpha">Test0.13alpha</a>, <a href="/wiki/Test0.13beta">Test0.13beta</a> 514 </p> 515 ------------------------------ 516 ============================== TitleIndex, compact format with prefix hidden, including Test0.13* but excluding Test0.131 517 [[TitleIndex(Test,format=compact,include=*0.13*,exclude=*1)]] 518 ------------------------------ 519 <p> 520 <a href="/wiki/Test0.13alpha">Test0.13alpha</a>, <a href="/wiki/Test0.13beta">Test0.13beta</a> 521 </p> 522 ------------------------------ 523 ============================== TitleIndex, compact format, excluding various topics 524 [[TitleIndex(Test,format=compact,exclude=Test0.13*:*0.11*:Test2:Test*i*)]] 525 ------------------------------ 526 <p> 527 <a href="/wiki/Test0.12Def">Test0.12Def</a>, <a href="/wiki/Test0.12Ijk">Test0.12Ijk</a>, <a href="/wiki/TestTest">TestTest</a> 528 </p> 529 ------------------------------ 530 ============================== TitleIndex, compact format, including and excluding various topics 531 [[TitleIndex(format=compact,include=*Group*:test2,exclude=*One)]] 532 ------------------------------ 533 <p> 534 <a href="/wiki/0.11/GroupTwo">0.11/GroupTwo</a> 535 </p> 536 ------------------------------ 537 """ 538
539 -def titleindex4_setup(tc):
540 add_pages(tc, [ 541 'TestTest', 542 'TestThing', 543 'Test2', 544 'Test0.11Abc', 545 'Test0.11/Abc', 546 'Test0.12Def', 547 'Test0.12Ijk', 548 'Test0.13alpha', 549 'Test0.13beta', 550 'Test0.131', 551 '0.11/Test', 552 '0.11/GroupOne', 553 '0.11/GroupTwo', 554 ])
555 556 557 TITLEINDEX5_MACRO_TEST_CASES = u""" 558 ============================== TitleIndex, hierarchy format with complex hierarchy 559 [[TitleIndex(format=hierarchy)]] 560 ------------------------------ 561 <p> 562 </p><div class="titleindex"><ul><li><a href="/wiki/TracDev">TracDev</a><ul><li><a href="/wiki/TracDev/ApiChanges">ApiChanges</a><ul><li><a href="/wiki/TracDev/ApiChanges/0.10">0.10</a></li><li><a href="/wiki/TracDev/ApiChanges/0.11">0.11</a></li><li><a href="/wiki/TracDev/ApiChanges/0.12">0.12</a><ul><li>Missing<ul><li><a href="/wiki/TracDev/ApiChanges/0.12/Missing/Exists">Exists</a></li></ul></li></ul></li></ul></li></ul></li><li><a href="/wiki/WikiStart">WikiStart</a></li></ul></div><p> 563 </p> 564 ------------------------------ 565 ============================== TitleIndex, hierarchy format with complex hierarchy (and min=5) 566 [[TitleIndex(format=hierarchy,min=5)]] 567 ------------------------------ 568 <p> 569 </p><div class="titleindex"><ul><li><a href="/wiki/TracDev">TracDev</a><ul><li><a href="/wiki/TracDev/ApiChanges">ApiChanges</a></li><li><a href="/wiki/TracDev/ApiChanges/0.10">ApiChanges/0.10</a></li><li><a href="/wiki/TracDev/ApiChanges/0.11">ApiChanges/0.11</a></li><li><a href="/wiki/TracDev/ApiChanges/0.12">ApiChanges/0.12</a></li><li><a href="/wiki/TracDev/ApiChanges/0.12/Missing/Exists">ApiChanges/0.12/Missing/Exists</a></li></ul></li><li><a href="/wiki/WikiStart">WikiStart</a></li></ul></div><p> 570 </p> 571 ------------------------------ 572 ============================== TitleIndex, group format with complex hierarchy 573 [[TitleIndex(format=group)]] 574 ------------------------------ 575 <p> 576 </p><div class="titleindex"><ul><li><strong>TracDev</strong><ul><li><a href="/wiki/TracDev">TracDev</a></li><li><strong>ApiChanges</strong><ul><li><a href="/wiki/TracDev/ApiChanges">TracDev/ApiChanges</a></li><li><a href="/wiki/TracDev/ApiChanges/0.10">TracDev/ApiChanges/0.10</a></li><li><a href="/wiki/TracDev/ApiChanges/0.11">TracDev/ApiChanges/0.11</a></li><li><strong>0.12</strong><ul><li><a href="/wiki/TracDev/ApiChanges/0.12">TracDev/ApiChanges/0.12</a></li><li><a href="/wiki/TracDev/ApiChanges/0.12/Missing/Exists">TracDev/ApiChanges/0.12/Missing/Exists</a></li></ul></li></ul></li></ul></li><li><a href="/wiki/WikiStart">WikiStart</a></li></ul></div><p> 577 </p> 578 ------------------------------ 579 """ 580
581 -def titleindex5_setup(tc):
582 add_pages(tc, [ 583 'TracDev', 584 'TracDev/ApiChanges', 585 'TracDev/ApiChanges/0.10', 586 'TracDev/ApiChanges/0.11', 587 'TracDev/ApiChanges/0.12', 588 'TracDev/ApiChanges/0.12/Missing/Exists', 589 ])
590 591 592 RECENTCHANGES_MACRO_TEST_CASES = u"""" 593 ============================== RecentChanges, group option 594 [[RecentChanges()]] 595 [[RecentChanges(group=date)]] 596 [[RecentChanges(group=none)]] 597 [[RecentChanges(,2,group=none)]] 598 [[RecentChanges(Wiki,group=none)]] 599 [[RecentChanges(Wiki,1,group=none)]] 600 ------------------------------ 601 <p> 602 </p><div><h3>%(date)s</h3><ul><li><a href="/wiki/WikiEnd">WikiEnd</a> 603 </li><li><a href="/wiki/WikiMid">WikiMid</a> 604 </li><li><a href="/wiki/WikiStart">WikiStart</a> 605 </li></ul></div><p> 606 </p><div><h3>%(date)s</h3><ul><li><a href="/wiki/WikiEnd">WikiEnd</a> 607 </li><li><a href="/wiki/WikiMid">WikiMid</a> 608 </li><li><a href="/wiki/WikiStart">WikiStart</a> 609 </li></ul></div><p> 610 </p><div><ul><li><a href="/wiki/WikiEnd">WikiEnd</a> 611 </li><li><a href="/wiki/WikiMid">WikiMid</a> 612 </li><li><a href="/wiki/WikiStart">WikiStart</a> 613 </li></ul></div><p> 614 </p><div><ul><li><a href="/wiki/WikiEnd">WikiEnd</a> 615 </li><li><a href="/wiki/WikiMid">WikiMid</a> 616 </li></ul></div><p> 617 </p><div><ul><li><a href="/wiki/WikiEnd">WikiEnd</a> 618 </li><li><a href="/wiki/WikiMid">WikiMid</a> 619 </li><li><a href="/wiki/WikiStart">WikiStart</a> 620 </li></ul></div><p> 621 </p><div><ul><li><a href="/wiki/WikiEnd">WikiEnd</a> 622 </li></ul></div><p> 623 </p> 624 ============================== 625 [[RecentChanges(Trac, --)]] 626 ------------------------------ 627 <p> 628 <div class="system-message"><strong>Macro RecentChanges(Trac, --) failed</strong><pre>Invalid macro argument <code>--</code></pre></div> 629 </p> 630 ------------------------------ 631 """ 632
633 -def recentchanges_setup(tc):
634 def add_pages(tc, names): 635 for name in names: 636 now = datetime_now(utc) 637 w = WikiPage(tc.env) 638 w.name = name 639 w.text = '--' 640 w.save('joe', 'the page ' + name, '::1', now)
641 add_pages(tc, [ 642 'WikiMid', 643 'WikiEnd', 644 ]) 645 tc.correct = tc.correct % {'date': format_date(tzinfo=utc, 646 locale=locale_en)} 647
648 -def recentchanges_teardown(tc):
649 tc.env.reset_db()
650 651 652 PAGEOUTLINE_MACRO_TEST_CASES = u"""" 653 ============================== 654 [[PageOutline(a)]] 655 ------------------------------ 656 <p> 657 <div class="system-message"><strong>Macro PageOutline(a) failed</strong><pre>Invalid macro argument <code>a</code></pre></div> 658 </p> 659 ============================== 660 [[PageOutline(a-b)]] 661 ------------------------------ 662 <p> 663 <div class="system-message"><strong>Macro PageOutline(a-b) failed</strong><pre>Invalid macro argument <code>a</code></pre></div> 664 </p> 665 ============================== 666 [[PageOutline(0)]] 667 = Heading Level 1 668 == Heading Level 2 669 ------------------------------ 670 <p> 671 </p><div class="wiki-toc"> 672 <ol> 673 <li> 674 <a href="#HeadingLevel1">Heading Level 1</a> 675 </li> 676 </ol> 677 </div><p> 678 </p> 679 <h1 id="HeadingLevel1">Heading Level 1</h1> 680 <h2 id="HeadingLevel2">Heading Level 2</h2> 681 ============================== 682 [[PageOutline(7)]] 683 ===== Heading Level 5 684 ====== Heading Level 6 685 ------------------------------ 686 <p> 687 </p><div class="wiki-toc"> 688 <ol> 689 <li> 690 <a href="#HeadingLevel6">Heading Level 6</a> 691 </li> 692 </ol> 693 </div><p> 694 </p> 695 <h5 id="HeadingLevel5">Heading Level 5</h5> 696 <h6 id="HeadingLevel6">Heading Level 6</h6> 697 ============================== 698 [[PageOutline(0-7)]] 699 = Heading Level 1 700 == Heading Level 2 701 === Heading Level 3 702 ==== Heading Level 4 703 ===== Heading Level 5 704 ====== Heading Level 6 705 ------------------------------ 706 <p> 707 </p><div class="wiki-toc"> 708 <ol> 709 <li> 710 <a href="#HeadingLevel1">Heading Level 1</a> 711 <ol> 712 <li> 713 <a href="#HeadingLevel2">Heading Level 2</a> 714 <ol> 715 <li> 716 <a href="#HeadingLevel3">Heading Level 3</a> 717 <ol> 718 <li> 719 <a href="#HeadingLevel4">Heading Level 4</a> 720 <ol> 721 <li> 722 <a href="#HeadingLevel5">Heading Level 5</a> 723 <ol> 724 <li> 725 <a href="#HeadingLevel6">Heading Level 6</a> 726 </li> 727 </ol> 728 </li> 729 </ol> 730 </li> 731 </ol> 732 </li> 733 </ol> 734 </li> 735 </ol> 736 </li> 737 </ol> 738 </div><p> 739 </p> 740 <h1 id="HeadingLevel1">Heading Level 1</h1> 741 <h2 id="HeadingLevel2">Heading Level 2</h2> 742 <h3 id="HeadingLevel3">Heading Level 3</h3> 743 <h4 id="HeadingLevel4">Heading Level 4</h4> 744 <h5 id="HeadingLevel5">Heading Level 5</h5> 745 <h6 id="HeadingLevel6">Heading Level 6</h6> 746 """ 747 748 749 TRACINI_MACRO_TEST_CASES = u"""\ 750 ============================== TracIni, option with empty doc (#10940) 751 [[TracIni(section-42)]] 752 ------------------------------ 753 <p> 754 </p><div class="tracini"><h3 id="section-42-section"><code>[section-42]</code></h3>\ 755 <table class="wiki"><tbody>\ 756 <tr class="even" id="section-42-option1-option">\ 757 <td><a class="tracini-option" href="#section-42-option1-option"><code>option1</code></a></td><td></td>\ 758 <td class="default"><code>value</code></td></tr>\ 759 <tr class="odd" id="section-42-option2-option">\ 760 <td><a class="tracini-option" href="#section-42-option2-option"><code>option2</code></a></td><td><p> 761 blah 762 </p> 763 </td><td class="default"><code>value</code></td></tr>\ 764 <tr class="even" id="section-42-option3-option">\ 765 <td><a class="tracini-option" href="#section-42-option3-option"><code>option3</code></a></td><td><p> 766 Doc for option3 767 </p> 768 </td><td class="default"><code>value</code></td></tr></tbody></table></div><p> 769 </p> 770 ------------------------------ 771 ============================== TracIni, list option with sep=| (#11074) 772 [[TracIni(section-list)]] 773 ------------------------------ 774 <p> 775 </p><div class="tracini">\ 776 <h3 id="section-list-section"><code>[section-list]</code></h3>\ 777 <table class="wiki"><tbody>\ 778 <tr class="even" id="section-list-option1-option">\ 779 <td><a class="tracini-option" href="#section-list-option1-option"><code>option1</code></a></td><td></td>\ 780 <td class="default"><code>4.2|42|42||0|enabled</code></td></tr>\ 781 </tbody></table>\ 782 </div><p> 783 </p> 784 ------------------------------ 785 ============================== TracIni, option with "false" value as default 786 [[TracIni(section-def)]] 787 ------------------------------ 788 <p> 789 </p><div class="tracini">\ 790 <h3 id="section-def-section"><code>[section-def]</code></h3>\ 791 <table class="wiki"><tbody>\ 792 <tr class="even" id="section-def-option1-option">\ 793 <td><a class="tracini-option" href="#section-def-option1-option"><code>option1</code></a></td><td>\ 794 </td><td class="nodefault">(no default)</td></tr>\ 795 <tr class="odd" id="section-def-option2-option">\ 796 <td><a class="tracini-option" href="#section-def-option2-option"><code>option2</code></a></td><td></td>\ 797 <td class="nodefault">(no default)</td></tr>\ 798 <tr class="even" id="section-def-option3-option">\ 799 <td><a class="tracini-option" href="#section-def-option3-option"><code>option3</code></a></td><td></td>\ 800 <td class="default"><code>0</code></td></tr>\ 801 <tr class="odd" id="section-def-option4-option">\ 802 <td><a class="tracini-option" href="#section-def-option4-option"><code>option4</code></a></td><td></td>\ 803 <td class="default"><code>disabled</code></td></tr>\ 804 <tr class="even" id="section-def-option5-option">\ 805 <td><a class="tracini-option" href="#section-def-option5-option"><code>option5</code></a></td><td></td>\ 806 <td class="nodefault">(no default)</td></tr>\ 807 </tbody></table>\ 808 </div><p> 809 </p> 810 ------------------------------ 811 ============================== TracIni, option argument 812 [[TracIni(,option5)]] 813 ------------------------------ 814 <p> 815 </p><div class="tracini">\ 816 <h3 id="section-def-section"><code>[section-def]</code></h3>\ 817 <table class="wiki"><tbody>\ 818 <tr class="even" id="section-def-option5-option">\ 819 <td><a class="tracini-option" href="#section-def-option5-option"><code>option5</code></a></td><td></td>\ 820 <td class="nodefault">(no default)</td></tr>\ 821 </tbody></table>\ 822 </div><p> 823 </p> 824 ------------------------------ 825 ============================== TracIni, option named argument 826 [[TracIni(option=opt?o*[24])]] 827 ------------------------------ 828 <p> 829 </p><div class="tracini">\ 830 <h3 id="section-42-section"><code>[section-42]</code></h3>\ 831 <table class="wiki"><tbody>\ 832 <tr class="even" id="section-42-option2-option">\ 833 <td><a class="tracini-option" href="#section-42-option2-option"><code>option2</code></a></td><td><p> 834 blah 835 </p> 836 </td><td class="default"><code>value</code></td></tr></tbody></table>\ 837 <h3 id="section-def-section"><code>[section-def]</code></h3>\ 838 <table class="wiki"><tbody>\ 839 <tr class="even" id="section-def-option2-option">\ 840 <td><a class="tracini-option" href="#section-def-option2-option"><code>option2</code></a></td><td></td>\ 841 <td class="nodefault">(no default)</td></tr>\ 842 <tr class="odd" id="section-def-option4-option">\ 843 <td><a class="tracini-option" href="#section-def-option4-option"><code>option4</code></a></td><td></td>\ 844 <td class="default"><code>disabled</code></td></tr>\ 845 </tbody></table>\ 846 </div><p> 847 </p> 848 ------------------------------ 849 ============================== TracIni, section and option named argument 850 [[TracIni(section=section-*,option=opt*[13])]] 851 ------------------------------ 852 <p> 853 </p><div class="tracini">\ 854 <h3 id="section-42-section"><code>[section-42]</code></h3>\ 855 <table class="wiki"><tbody>\ 856 <tr class="even" id="section-42-option1-option">\ 857 <td><a class="tracini-option" href="#section-42-option1-option"><code>option1</code></a></td><td></td>\ 858 <td class="default"><code>value</code></td></tr>\ 859 <tr class="odd" id="section-42-option3-option">\ 860 <td><a class="tracini-option" href="#section-42-option3-option"><code>option3</code></a></td>\ 861 <td><p> 862 Doc for option3 863 </p> 864 </td><td class="default"><code>value</code></td></tr>\ 865 </tbody></table>\ 866 <h3 id="section-def-section"><code>[section-def]</code></h3>\ 867 <table class="wiki"><tbody>\ 868 <tr class="even" id="section-def-option1-option">\ 869 <td><a class="tracini-option" href="#section-def-option1-option"><code>option1</code></a></td><td></td>\ 870 <td class="nodefault">(no default)</td></tr>\ 871 <tr class="odd" id="section-def-option3-option">\ 872 <td><a class="tracini-option" href="#section-def-option3-option"><code>option3</code></a></td><td></td>\ 873 <td class="default"><code>0</code></td></tr>\ 874 </tbody></table>\ 875 <h3 id="section-list-section"><code>[section-list]</code></h3>\ 876 <table class="wiki"><tbody>\ 877 <tr class="even" id="section-list-option1-option">\ 878 <td><a class="tracini-option" href="#section-list-option1-option"><code>option1</code></a></td><td></td>\ 879 <td class="default"><code>4.2|42|42||0|enabled</code></td></tr>\ 880 </tbody></table>\ 881 </div><p> 882 </p> 883 ------------------------------ 884 ============================== TracIni, section with no options 885 [[TracIni(section=section-no-options)]] 886 ------------------------------ 887 <p> 888 </p><div class="tracini">\ 889 <h3 id="section-no-options-section"><code>[section-no-options]</code></h3>\ 890 <p> 891 No options 892 </p> 893 </div><p> 894 </p> 895 ------------------------------ 896 ============================== TracIni, ordered arguments don't glob 897 [[TracIni(section*,option*)]] 898 ------------------------------ 899 <p> 900 </p><div class="tracini"></div><p> 901 </p> 902 ------------------------------ 903 """ 904
905 -def tracini_setup(tc):
906 tc._orig_registries = ConfigSection.registry, Option.registry 907 class Foo(object): 908 section = (ConfigSection)('section-no-options', doc='No options') 909 option_a1 = (Option)('section-42', 'option1', 'value', doc='') 910 option_a2 = (Option)('section-42', 'option2', 'value', doc='blah') 911 option_a3 = (Option)('section-42', 'option3', 'value', 912 doc='Doc for %(name)s', 913 doc_args={'name': 'option3'}) 914 option_l1 = (ListOption)('section-list', 'option1', 915 [4.2, '42', 42, None, 0, True], sep='|', 916 keep_empty=True) 917 option_d1 = (Option)('section-def', 'option1', None) 918 option_d2 = (Option)('section-def', 'option2', '') 919 option_d3 = (IntOption)('section-def', 'option3', 0) 920 option_d4 = (BoolOption)('section-def', 'option4', False) 921 option_d5 = (ListOption)('section-def', 'option5', [])
922
923 -def tracini_teardown(tc):
924 ConfigSection.registry, Option.registry = tc._orig_registries
925 926
927 -def test_suite():
928 suite = unittest.TestSuite() 929 suite.addTest(formatter.test_suite(IMAGE_MACRO_TEST_CASES, 930 file=__file__, 931 setup=image_setup, 932 teardown=image_teardown)) 933 suite.addTest(formatter.test_suite(INTERTRAC_MACRO_TEST_CASES, 934 file=__file__, 935 setup=intertrac_setup)) 936 suite.addTest(formatter.test_suite(TITLEINDEX1_MACRO_TEST_CASES, 937 file=__file__)) 938 suite.addTest(formatter.test_suite(TITLEINDEX2_MACRO_TEST_CASES, 939 file=__file__, 940 setup=titleindex2_setup, 941 teardown=titleindex_teardown)) 942 suite.addTest(formatter.test_suite(TITLEINDEX3_MACRO_TEST_CASES, 943 file=__file__, 944 setup=titleindex3_setup, 945 teardown=titleindex_teardown, 946 context=('wiki', 'WikiStart/Second'))) 947 suite.addTest(formatter.test_suite(TITLEINDEX4_MACRO_TEST_CASES, 948 file=__file__, 949 setup=titleindex4_setup, 950 teardown=titleindex_teardown)) 951 suite.addTest(formatter.test_suite(TITLEINDEX5_MACRO_TEST_CASES, 952 file=__file__, 953 setup=titleindex5_setup, 954 teardown=titleindex_teardown)) 955 suite.addTest(formatter.test_suite(RECENTCHANGES_MACRO_TEST_CASES, 956 file=__file__, 957 setup=recentchanges_setup, 958 teardown=recentchanges_teardown)) 959 suite.addTest(formatter.test_suite(PAGEOUTLINE_MACRO_TEST_CASES, 960 file=__file__)) 961 suite.addTest(formatter.test_suite(TRACINI_MACRO_TEST_CASES, 962 file=__file__, 963 setup=tracini_setup, 964 teardown=tracini_teardown)) 965 return suite
966 967 968 if __name__ == '__main__': 969 unittest.main(defaultTest='test_suite') 970