"""
import unittest
import bs4 # beautiful soup
+import wradmin.model
import wradmin
self.assertIn('Gasthaus', soup.title.text)
self.assertIn('Meißner', str(soup))
- def test_gasthaus_update(self):
+ def test_gasthaus_update_success(self):
result = self.app.get('/gasthaus/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 Gasthausliste wurde erfolgreich aktualisiert.', str(soup))
+ def test_gasthaus_update_fail(self):
+ session = wradmin.model.meta.Session
+ text = session.query(wradmin.model.MwText).get(8719)
+ text.old_text = text.old_text.replace('maria-waldrast@aon.at', 'abc@def@example.com')
+ session.commit()
+ result = self.app.get('/gasthaus/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 Gasthaus \'Maria Waldrast (Klostergasthaus)\'', str(soup))
+
def test_rodelbahn_list(self):
result = self.app.get('/rodelbahn/list')
self.assertEqual(result.status_code, 200)