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

Test URL building with user keys

parent 9137ee2c
from import Storage
from ass2m.users import User
from ass2m.server import Server
from ass2m.template import build_url, build_root_url
from ass2m.filters import quote_url
......@@ -21,6 +22,17 @@ class BuildURLTest(TestCase):
self.root_url = build_root_url(
user = User(, 'user1')
user.realname = 'Penguin'
user.password = 'monkey1'
user.key = 'fabf37d746da8a45df63489f642b3813'
user = User(, 'user2')
user.realname = 'Penguin'
user.password = 'monkey1'
def tearDown(self):
if self.root:
......@@ -38,3 +50,15 @@ class BuildURLTest(TestCase):
os.mkdir(os.path.join(self.root, 'penguin'))
assert quote_url(build_url(self.root_url,'/penguin'))) \
== 'http://penguin:42/penguin/'
def test_buildKeyUrls(self):
assert quote_url(build_url(self.root_url,'/penguin'),'user1'))) \
== 'http://penguin:42/penguin?authkey=fabf37d746da8a45df63489f642b3813'
# no user.key
assert quote_url(build_url(self.root_url,'/penguin'),'user2'))) \
== '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