Commit f4abbe60 authored by ale's avatar ale

fix certificate download test

parent 034bd64a
......@@ -26,6 +26,7 @@ class VpnAppTest(unittest.TestCase):
''',
'AUTH_ENABLE': True,
'AUTH_FUNCTION': lambda x, y: (x and y and x == y),
'TLS_AUTH_KEY': self.tmpdir + '/tlsauth.key',
}
self.app = vpn_app.make_app(self.config)
......@@ -57,11 +58,13 @@ class VpnAppTest(unittest.TestCase):
self.assertTrue('Authentication failed' in rv.data)
def test_cert_dl(self):
cn = 'testcn1234'
t = self.app.signer.encode(cn)
with self.app.test_client() as c:
with c.session_transaction() as sess:
sess['dl_ok'] = True
sess['_csrf'] = 'csrf'
sess['logged_in'] = True
rv = c.get('/newcertdl?_csrf=csrf')
rv = c.get('/newcertdl?_csrf=csrf&t=' + t)
self.assertEquals('200 OK', rv.status)
self.assertEquals('application/zip', rv.content_type)
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