allura
修订版 | 5b8ca9992fe32b5a4380e4d75fbaa7c6f2ca3d08 (tree) |
---|---|
时间 | 2012-06-13 03:59:09 |
作者 | Igor Bondarenko <jetmind2@gmai...> |
Commiter | Cory Johns |
[#3792] ticket:72 add test for mailto: links in wiki pages
@@ -488,3 +488,31 @@ class TestRootController(TestController): | ||
488 | 488 | response = self.app.get('/wiki/browse_pages/') |
489 | 489 | assert 'aaa' in response |
490 | 490 | assert '?deleted=True">bbb' in response |
491 | + | |
492 | + def test_mailto_links(self): | |
493 | + self.app.get('/wiki/test_mailto/') | |
494 | + params = { | |
495 | + 'title':'test_mailto', | |
496 | + 'text':''' | |
497 | +* Automatic mailto #1 <darth.vader@deathstar.org> | |
498 | +* Automatic mailto #2 <mailto:luke.skywalker@tatooine.org> | |
499 | +* Handmaid mailto <a href="mailto:yoda@jedi.org">Email Yoda</a> | |
500 | +''', | |
501 | + 'labels':'', | |
502 | + 'labels_old':'', | |
503 | + 'viewable_by-0.id':'all'} | |
504 | + self.app.post('/wiki/test_mailto/update', params=params) | |
505 | + r = self.app.get('/wiki/test_mailto/') | |
506 | + mailto_links = 0 | |
507 | + for link in r.html.findAll('a'): | |
508 | + if link.get('href') == 'mailto:darth.vader@deathstar.org': | |
509 | + assert 'notfound' not in link.get('class', '') | |
510 | + mailto_links +=1 | |
511 | + if link.get('href') == 'mailto:luke.skywalker@tatooine.org': | |
512 | + assert 'notfound' not in link.get('class', '') | |
513 | + mailto_links += 1 | |
514 | + if link.get('href') == 'mailto:yoda@jedi.org': | |
515 | + assert link.contents == ['Email Yoda'] | |
516 | + assert 'notfound' not in link.get('class', '') | |
517 | + mailto_links += 1 | |
518 | + assert mailto_links == 3, 'Wrong number of mailto links' |