Commit 5b94733f authored by Laurent Bachelier's avatar Laurent Bachelier

Add tests for URL building

parent 5aa9b51b
from import Storage
from ass2m.server import Server
from ass2m.template import build_url, build_root_url
from ass2m.filters import quote_url
from unittest import TestCase
from webtest import TestApp
from tempfile import mkdtemp
import shutil
class BuildURLTest(TestCase):
def setUp(self):
self.root = mkdtemp(prefix='ass2m_test_root') = Storage.create(self.root)
server = Server(self.root)
app = TestApp(server.process)
# fill root_url
self.root_url = build_root_url(
def tearDown(self):
if self.root:
def test_buildRootUrl(self):
assert self.root_url.url == 'http://penguin:42/'
assert build_root_url(None) is None
def test_buildSimpleUrl(self):
assert quote_url(build_url(self.root_url,''))) \
== 'http://penguin:42/'
assert quote_url(build_url(self.root_url,'/penguin'))) \
== 'http://penguin:42/penguin'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment