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))