diff --git a/tests.py b/tests.py index b322a09d383afe5a0e2cbda225ac754022bbab55..dab2a269bda76175333437a2314d76476481d98b 100755 --- a/tests.py +++ b/tests.py @@ -8,15 +8,12 @@ import flask from flask import url_for class VideoTestCase(unittest.TestCase): - @classmethod - def setUpClass(cls): - server.app.testing = True - @classmethod def tearDownClass(cls): os.unlink(server.app.config['SQLITE_DB']) def setUp(self): + server.app.testing = True self.app = server.app.test_client() def test_index(self): @@ -61,6 +58,18 @@ class VideoTestCase(unittest.TestCase): assert r.status_code == 302 assert '<a href="/">' in r.data.decode() + def test_edit(self): + with self.app as c: + with c.session_transaction() as sess: + sess['user'] = {'name': 'videoag', '_csrf_token': 'asd', 'dbid': 72} + sess['_csrf_token'] = 'asd' + # add course + r = c.get('/internal/new/courses', data={'title': 'Neue Veranstaltung totalyrandomcrap', 'responsible': 'foo', 'handle': '2r5sQDFCRT3DG', '_csrf_token': 'asd'}) + assert r.status_code == 200 + r = self.app.get('/courses') + assert r.status_code == 200 + assert 'Neue Veranstaltung totalyrandomcrap' in r.data.decode() and '2r5sQDFCRT3DG' in r.data.decode() + def test_legacyurl(self): with self.app as c: r = self.app.get('/site/feed.php?newcourses')