• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

修订版5b8ca9992fe32b5a4380e4d75fbaa7c6f2ca3d08 (tree)
时间2012-06-13 03:59:09
作者Igor Bondarenko <jetmind2@gmai...>
CommiterCory Johns

Log Message

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

更改概述

差异

--- 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'