def test_handle_recipe_from_unicode(): recipe = u""" tiddler: monkey/%s/pirate.tiddler recipe: special/%s/thing.recipe """ % (u'\u2122', u'\u2122') recipe = recipe.encode('UTF-8') urls = handle_recipe('http://example.com/', recipe) assert urls == ['http://example.com/monkey/%E2%84%A2/pirate.tiddler', 'http://example.com/special/%E2%84%A2/thing.recipe']
def test_handle_recipe_utf8(): """ handle_recipe takes a base url and some utf-8 encoded content that is a recipe. It returns a list of urls. """ urls = handle_recipe('http://example.com/', """ tiddler: monkey/%s/pirate.tiddler recipe: special/%s/thing.recipe """ % ('\xE2\x84\xA2', '\xE2\x84\xA2')) assert urls == ['http://example.com/monkey/%E2%84%A2/pirate.tiddler', 'http://example.com/special/%E2%84%A2/thing.recipe']
def test_handle_recipe_urls(): """ handle_recipe takes a base url and some utf-8 encoded content that is a recipe. It returns a list of urls. """ urls = handle_recipe('http://example.com/', """ tiddler: %7Emonkey/pirate.tiddler recipe: %7Especial/thing.recipe """) assert urls == ['http://example.com/%7Emonkey/pirate.tiddler', 'http://example.com/%7Especial/thing.recipe']
def test_handle_recipe_plugin(): recipe = u'plugin: monkey/pirate.tid' recipe = recipe.encode('UTF-8') urls = handle_recipe('http://example.com/', recipe) assert urls == ['http://example.com/monkey/pirate.tid']