]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/blobdiff - tests/test_wradmin.py
Add test_coordtool_convert_error.
[philipp/winterrodeln/wradmin.git] / tests / test_wradmin.py
index 9eb227f398f54d668a810bb5e299eb73f8b9f520..5fb5003e4ef7073abd0fa9ed6f39c35d6c94e2f8 100644 (file)
@@ -28,6 +28,22 @@ class TestNoDbWradmin(WradminTestBase):
         soup = bs4.BeautifulSoup(result.data, 'html.parser')
         self.assertEqual(soup.title.text, 'Koordinaten-Rechner')
 
+    def test_coordtool_convert_ok(self):
+        result = self.app.post('/coordtool/convert', data={'input': '47.987, 11.123'}, 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.assertEqual(soup.title.text, 'Koordinaten-Rechner')
+        self.assertIn('GPX Format', str(soup))
+
+    def test_coordtool_convert_error(self):
+        result = self.app.post('/coordtool/convert', data={'input': 'abc'}, 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.assertEqual(soup.title.text, 'Koordinaten-Rechner')
+        self.assertIn('no known format', str(soup))
+
 
 class TestDbWradmin(WradminTestBase):
     def setUp(self):
@@ -81,7 +97,7 @@ class TestDbWradmin(WradminTestBase):
         self.assertIn('Meißner', str(soup))
 
     def test_gasthaus_update(self):
-        result = self.app.get('/gasthaus/update')
+        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')
@@ -107,14 +123,14 @@ class TestDbWradmin(WradminTestBase):
         self.assertIn('Hühnerspiel', str(soup))
 
     def test_rodelbahn_update(self):
-        result = self.app.get('/rodelbahn/update')
+        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_regioncache(self):
-        result = self.app.get('/rodelbahn/update_regioncache')
+        result = self.app.get('/rodelbahn/update_regioncache', follow_redirects=True)
         self.assertEqual(result.status_code, 200)
         self.assertTrue(result.data.startswith(b'<!DOCTYPE html'))
         soup = bs4.BeautifulSoup(result.data, 'html.parser')