Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dcolish committed Jul 25, 2010
1 parent 895f4df commit c97f211
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
namespace_packages=['flaskext'],
zip_safe=False,
platforms='any',
test_suite = "nose.collector",

install_requires=[
'markdown',
],
test_suite="nose.collector",
tests_require=[
'nose',
],
Expand Down
35 changes: 29 additions & 6 deletions tests/test_markdown.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,45 @@
from flask import Flask, render_template_string

from flaskext.markdown import Markdown
mystr = u'This is *markdown*'


def run_client():
app = Flask(__name__)
app.debug = True
md = Markdown(app)

@app.route('/test_render')
def view_markdown_render():

@app.route('/test_inline')
def view_render_inline():
mystr = u'This is *markdown*'
return render_template_string('{{mystr|markdown}}', mystr=mystr)

@app.route('/test_var_block')
def view_render_var_block():
mystr = u'This is a *markdown* block'
template = '''{% filter markdown %}{{mystr}}{% endfilter %}'''
return render_template_string(template, mystr=mystr)

@app.route('/test_in_block')
def view_render_in_block():
tmp = u'{% filter markdown %}This is a *markdown* block{% endfilter %}'
return render_template_string(tmp)

return app.test_client()


def test_render_markdown():
def test_render_inline():
client = run_client()
resp = client.open('/test_render')
resp = client.open('/test_inline')
assert resp.data == '<p>This is <em>markdown</em></p>'


def test_render_var_block():
client = run_client()
resp = client.open('/test_var_block')
assert resp.data == '<p>This is a <em>markdown</em> block</p>'


def test_render_in_block():
client = run_client()
resp = client.open('/test_in_block')
assert resp.data == '<p>This is a <em>markdown</em> block</p>'

0 comments on commit c97f211

Please sign in to comment.