Changeset 1510 for trunk/pylucid/tests/__init__.py
- Timestamp:
- 03/27/08 16:59:44 (8 months ago)
- Files:
-
- 1 modified
-
trunk/pylucid/tests/__init__.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pylucid/tests/__init__.py
r1507 r1510 225 225 is_list2 = pprint.pformat(is_list) 226 226 should_be_list2 = pprint.pformat(should_be_list) 227 print "\nThe two lists are not the same:" 227 228 for line in make_diff(should_be_list2, is_list2): 228 229 print line … … 313 314 314 315 # _________________________________________________________________________ 315 # common tests: 316 # link snapshot: 317 316 318 def link_snapshot_test(self, snapshot): 317 319 """ … … 330 332 331 333 self.assertLists(is_links, should_be_links, sort=False) 334 335 def create_link_snapshot(self, print_result=True): 336 """ 337 Build a a reference snapshot for a unittest. 338 Display it via pprint and returned it, too. 339 Usefull for copy&paste the output into this source file :) 340 """ 341 if print_result: 342 print "Build a snapshot for the unittest compare:" 343 print "-"*79 344 data = {} 345 for page in Page.objects.all(): 346 url = page.get_absolute_url() 347 348 response = self.client.get(url) 349 self.failUnlessEqual(response.status_code, 200) 350 351 content = response.content.strip() 352 links = self.get_links(content) 353 354 data[url] = links 355 356 if print_result: 357 pprint.pprint(data) 358 print "-"*79 359 return data 332 360 333 361 … … 391 419 392 420 393 def create_template( content):421 def create_template(**kwargs): 394 422 """ 395 423 Delete all existing templates, create a new one and return the instance. … … 397 425 Template.objects.all().delete() 398 426 399 template = Template( content = content)427 template = Template(**kwargs) 400 428 template.save() 401 429 return template … … 421 449 default_template = Template.objects.all()[0] 422 450 default_style = Style.objects.all()[0] 423 default_markup = 0 # html with dout TinyMCE451 default_markup = 0 # html without TinyMCE 424 452 425 453 page = Page( 426 454 name = data.get("name", "New Page"), 427 455 shortcut = data.get("shortcut", None), 456 content = data.get("content", "TestPageContent"), 428 457 template = data.get("template", default_template), 429 458 style = data.get("style", default_style),
