• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoawindowspythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdombtronvb.netdirectxarduinopreviewerゲームエンジン

allura


Commit MetaInfo

修訂cdd3cb605399866fd1518878b24716a9c6c6758f (tree)
時間2012-06-05 22:08:37
作者Igor Bondarenko <jetmind2@gmai...>
CommiterIgor Bondarenko

Log Message

[#3792] ticket:72 add test for mailto: links in wiki pages

Change Summary

差異

--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -488,3 +488,31 @@ class TestRootController(TestController):
488488 response = self.app.get('/wiki/browse_pages/')
489489 assert 'aaa' in response
490490 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'