self.assertIn('Rodelbahn', soup.title.text)
self.assertIn('Hühnerspiel', str(soup))
- def test_rodelbahn_update(self):
+ def test_rodelbahn_update_success(self):
result = self.app.get('/rodelbahn/update', follow_redirects=True)
self.assertEqual(result.status_code, 200)
self.assertTrue(result.data.startswith(b'<!doctype html'))
soup = bs4.BeautifulSoup(result.data, 'html.parser')
self.assertIn('Die Rodelbahnliste wurde erfolgreich aktualisiert.', str(soup))
+ def test_rodelbahn_update_fail(self):
+ session = wradmin.model.meta.Session
+ text = session.query(wradmin.model.MwText).get(12106)
+ text.old_text = text.old_text.replace('Schwierigkeit = mittel', 'Schwierigkeit = geht so')
+ session.commit()
+ result = self.app.get('/rodelbahn/update', follow_redirects=True)
+ self.assertEqual(result.status_code, 200)
+ self.assertTrue(result.data.startswith(b'<!doctype html'))
+ soup = bs4.BeautifulSoup(result.data, 'html.parser')
+ self.assertIn('Fehler bei Rodelbahn \'Juifenalm\'', str(soup))
+
def test_rodelbahn_update_regioncache(self):
result = self.app.get('/rodelbahn/update_regioncache', follow_redirects=True)
self.assertEqual(result.status_code, 200)