Commit 4b802576 authored by Andreas Valder's avatar Andreas Valder
Browse files

added tests for legacy urls

parent bf360f0a
......@@ -5,6 +5,7 @@ import unittest
import server
import flask
from flask import url_for
class VideoTestCase(unittest.TestCase):
@classmethod
......@@ -50,7 +51,40 @@ class VideoTestCase(unittest.TestCase):
assert flask.session['user']
assert r.status_code == 403
assert 'Login fehlgeschlagen' in r.data.decode()
def test_legacyurl(self):
with self.app as c:
r = self.app.get('/site/feed.php?newcourses')
assert r.status_code == 302
assert url_for('courses_feed') in r.data.decode()
r = self.app.get('/?view=faq')
assert r.status_code == 302
assert url_for('faq') in r.data.decode()
r = self.app.get('/site/feed.php?all')
assert r.status_code == 302
assert url_for('feed') in r.data.decode()
r = self.app.get('/?course=16ws-progra')
assert r.status_code == 302
assert url_for('course', handle='16ws-progra') in r.data.decode()
r = self.app.get('/?view=player&lectureid=7319')
assert r.status_code == 302
assert url_for('lecture', id='7319', course='16ws-progra') in r.data.decode()
r = self.app.get('/site/feed.php?16ws-afi')
assert r.status_code == 302
assert url_for('feed', handle='16ws-afi') in r.data.decode()
r = self.app.get('/site/feed.php?lecture=7319')
assert r.status_code == 302
assert False # missing
r = self.app.get('/site/feed.php?vid=6088')
assert r.status_code == 302
assert False # missing
if __name__ == '__main__':
unittest.main()
......
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