1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
from textile import Textile
def test_image():
t = Textile()
result = t.image('!/imgs/myphoto.jpg!:http://jsamsa.com')
expect = ('<a href="{0}1:url"><img alt="" src="{0}2:url" /></a>'.format(
t.uid))
assert result == expect
assert t.refCache[1] == 'http://jsamsa.com'
assert t.refCache[2] == '/imgs/myphoto.jpg'
result = t.image('!</imgs/myphoto.jpg!')
expect = '<img align="left" alt="" src="{0}3:url" />'.format(t.uid)
assert result == expect
assert t.refCache[3] == '/imgs/myphoto.jpg'
t = Textile(rel='nofollow')
result = t.image('!/imgs/myphoto.jpg!:http://jsamsa.com')
expect = ('<a href="{0}1:url" rel="nofollow"><img alt="" src="{0}2:url" '
'/></a>'.format(t.uid))
assert result == expect
|