Implement test_bahn.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 23 Jul 2017 19:24:00 +0000 (19:24 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 23 Jul 2017 19:24:00 +0000 (19:24 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrfeed/trunk@2655 7aebc617-e5e2-0310-91dc-80fb5f6d2477

tests/test_wrfeed.py

index b24be969d1e00fe6915ddeb1a2b9332c88da5e8c..172ea77194d62ac2d75ac878aee91220102808df 100644 (file)
@@ -60,3 +60,17 @@ class TestDbWrfeed(WrfeedTestBase):
         root = et.fromstring(result.data)
         self.assertIn('Rodelbahnberichte', root.find('{http://www.w3.org/2005/Atom}title').text)
         self.assertEqual(len(root.findall('{http://www.w3.org/2005/Atom}entry')), 7)
+
+    def test_bahn(self):
+        bahn_count = {
+            'haunold': 1,
+            'pleisenhütte_axamer_lizum': 2,
+            'prantner_alm': 0,
+            'birgitzer_alm_(vom_adelshof)': 1,
+        }
+        for bahn, count in bahn_count.items():
+            result = self.app.get('/berichte/bahn/{}'.format(bahn))
+            self.assertTrue(result.data.startswith(b'<?xml'))
+            root = et.fromstring(result.data)
+            self.assertIn('Rodelbahnberichte', root.find('{http://www.w3.org/2005/Atom}title').text)
+            self.assertEqual(len(root.findall('{http://www.w3.org/2005/Atom}entry')), count, '"{}" not found {} times'.format(bahn, count))