]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/commitdiff
Now the failure mode when updating inns is tested as well.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 10 May 2019 22:14:47 +0000 (22:14 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 10 May 2019 22:14:47 +0000 (22:14 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wradmin/trunk@2809 7aebc617-e5e2-0310-91dc-80fb5f6d2477

tests/test_wradmin.py

index e443325e9c4e2c889e337e0ccbaf0a6186a23377..f9963dd4576f9db1cb10509187344e682be0496f 100644 (file)
@@ -4,6 +4,7 @@ WRADMIN_SETTINGS=../wradmin/test.cfg python3 -m unittest tests.test_wradmin
 """
 import unittest
 import bs4  # beautiful soup
+import wradmin.model
 import wradmin
 
 
@@ -115,13 +116,24 @@ class TestDbWradmin(WradminTestBase):
         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)