Skip to content
Snippets Groups Projects
Commit b7f2674b authored by Andreas Valder's avatar Andreas Valder
Browse files

added a test for adding a new course

parent d7db07d2
No related branches found
No related tags found
No related merge requests found
......@@ -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')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment