Example #1
0
 def test_hard_filters_none(self):
     r = ReportConfiguration(
         filtering=None
     )
     context = dict()
     filters = r.get_hard_filters(context)
     self.assertEqual(filters, {})
Example #2
0
 def test_get_hard_filters(self):
     r = ReportConfiguration(
         filtering="office={{selected_office}}\nnte__lt={{ today }}\nuser.first_name={{ first_name }}"
     )
     context = dict(
         selected_office="Testing",
         today="Now",
         first_name="User"
     )
     filters = r.get_hard_filters(context)
     self.assertIn('office', filters.keys())
     self.assertIn('nte__lt', filters.keys())
     self.assertIn('user__first_name', filters.keys())
     self.assertEqual(filters['office'], 'Testing')
     self.assertEqual(filters['nte__lt'], 'Now')
     self.assertEqual(filters['user__first_name'], 'User')