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

tests/test_wrfeed.py

index 172ea77194d62ac2d75ac878aee91220102808df..c057b12dc62d3646a6026fc8554cc01e66b081f0 100644 (file)
@@ -74,3 +74,16 @@ 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')), count, '"{}" not found {} times'.format(bahn, count))
+
+    def test_region(self):
+        region_count = {
+            'tirol': 6,
+            'schweiz': 1,
+            'innsbruck': 3,
+        }
+        for region, count in region_count.items():
+            result = self.app.get('/berichte/region/{}'.format(region))
+            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(region, count))