]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/blobdiff - tests/test_wradmin.py
Remove obsolete tests and fix existing tests.
[philipp/winterrodeln/wradmin.git] / tests / test_wradmin.py
index f9963dd4576f9db1cb10509187344e682be0496f..67505b3d4b57d4ccee8ebac9f0cff26b304b18cf 100644 (file)
@@ -1,7 +1,3 @@
-"""How to test wradmin:
-
-WRADMIN_SETTINGS=../wradmin/test.cfg python3 -m unittest tests.test_wradmin
-"""
 import unittest
 import bs4  # beautiful soup
 import wradmin.model
@@ -153,13 +149,24 @@ class TestDbWradmin(WradminTestBase):
         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)