diff --git a/tests.py b/tests.py index 805d78f02ac8b98e2e157dfe641d0b7ef79c4c84..3de756841844773c0932432561c596be45915eab 100755 --- a/tests.py +++ b/tests.py @@ -39,6 +39,11 @@ class VideoTestCase(unittest.TestCase): self.login(c) r = c.get('/courses') assert r.status_code == 200 + + def test_lecture(self): + with self.app as c: + r = c.get('/15ws-afi/6981') + assert r.status_code == 200 def test_course(self): with self.app as c: @@ -246,6 +251,29 @@ class VideoTestCase(unittest.TestCase): r = self.app.post('/internal/jobs/api/job/1/ping', data={'apikey': '1', 'host': 'test', 'status': '{}', 'state': '{}'}) assert r.status_code == 205 + def test_sorter(self): + with self.app as c: + r = self.app.get('/courses') + import sorter + + match, fmt = sorter.sort_file('08ws-swt-081118.mp4') + assert len(match) == 1 + assert match[0]['id'] == 104 + + match, fmt = sorter.sort_file('15ss-zkk-extremale-codes-1080p.mp4') + assert len(match) == 1 + assert match[0]['id'] == 6095 + + def test_campusimport(self): + with self.app as c: + self.login(c) + + r = self.app.post('/internal/import/257', data={'campus.new.url': 'https://www.campus.rwth-aachen.de/rwth/all/event.asp?gguid=0x4664DBD60E5A02479B53089BF0EB0681&tguid=0x0B473CF286B45B4984CD02565C07D6F8', 'campus.new.type': 'Vorlesung'}) + assert r.status_code == 200 + + r = self.app.get('/internal/import/257/now') + assert r.status_code == 200 + if __name__ == '__main__': unittest.main()