Пример #1
0
 def test_filter_by_town(self):
     filtering = {'towns': [self.town2]}
     r = ServiceReport(**filtering)
     stats = normalize_stats(r._get_service_stats())
     expected = {
         UtilityWork: ((UtilityWork.service.title, 1),)
     }
     self.assertEqual(stats, expected)
Пример #2
0
 def test_filter_by_date_from(self):
     filtering = {'date_from': date(2012, 1, 1)}
     r = ServiceReport(**filtering)
     stats = normalize_stats(r._get_service_stats())
     expected = {
         SocialWork: ((SocialWork.service.title, 1), (SocialWork._meta.get_field('other').verbose_name.__unicode__(), 1))
     }
     self.assertEqual(stats, expected)
Пример #3
0
 def test_filter_by_person(self):
     filtering = {'person': self.client2}
     r = ServiceReport(**filtering)
     stats = normalize_stats(r._get_service_stats())
     expected = {
         Address: ((Address.service.title, 1),)
     }
     self.assertEqual(stats, expected)
Пример #4
0
 def test_filter_by_date_from(self):
     filtering = {'date_from': date(2012, 1, 1)}
     r = ServiceReport(**filtering)
     stats = normalize_stats(r._get_service_stats())
     expected = {
         SocialWork:
         ((SocialWork.service.title, 1),
          (SocialWork._meta.get_field('other').verbose_name.__unicode__(),
           1))
     }
     self.assertEqual(stats, expected)
Пример #5
0
 def test_no_filter(self):
     filtering = {}
     r = ServiceReport(**filtering)
     stats = normalize_stats(r._get_service_stats())
     expected = {
         Address: ((Address.service.title, 3),),
         UtilityWork: ((UtilityWork.service.title, 1),),
         SocialWork: ((SocialWork.service.title, 2), (SocialWork._meta.get_field('other').verbose_name.__unicode__(), 1)),
         # InformationService: ((InformationService.service.title, 1),),
         HarmReduction: ((HarmReduction.service.title, 1), (HarmReduction._meta.get_field('condoms').verbose_name.__unicode__(), 1), (HarmReduction._meta.get_field('in_count').verbose_name.__unicode__(), 87))
     }
     self.assertEqual(stats, expected)
Пример #6
0
 def test_no_filter(self):
     filtering = {}
     r = ServiceReport(**filtering)
     stats = normalize_stats(r._get_service_stats())
     expected = {
         Address: ((Address.service.title, 3), ),
         UtilityWork: ((UtilityWork.service.title, 1), ),
         SocialWork:
         ((SocialWork.service.title, 2),
          (SocialWork._meta.get_field('other').verbose_name.__unicode__(),
           1)),
         # InformationService: ((InformationService.service.title, 1),),
         HarmReduction:
         ((HarmReduction.service.title, 1), (HarmReduction._meta.get_field(
             'condoms').verbose_name.__unicode__(), 1),
          (HarmReduction._meta.get_field(
              'in_count').verbose_name.__unicode__(), 87))
     }
     self.assertEqual(stats, expected)
Пример #7
0
 def test_filter_by_person(self):
     filtering = {'person': self.client2}
     r = ServiceReport(**filtering)
     stats = normalize_stats(r._get_service_stats())
     expected = {Address: ((Address.service.title, 1), )}
     self.assertEqual(stats, expected)
Пример #8
0
 def test_include_in_reports(self):
     classes = [s for s in service_list() if s.service.include_in_reports]
     stat_classes = [s[0] for s in ServiceReport()._get_service_stats()]
     self.assertEqual(classes, stat_classes)
Пример #9
0
 def test_filter_by_town(self):
     filtering = {'towns': [self.town2]}
     r = ServiceReport(**filtering)
     stats = normalize_stats(r._get_service_stats())
     expected = {UtilityWork: ((UtilityWork.service.title, 1), )}
     self.assertEqual(stats, expected)
Пример #10
0
 def test_filter_by_date_to(self):
     filtering = {'date_to': date(2010, 1, 1)}
     r = ServiceReport(**filtering)
     stats = normalize_stats(r.get_stats())
     expected = {None: ((u'Počet kontaktů (z toho přímých)', '0 (0)'), )}
     self.assertEqual(stats, expected)
Пример #11
0
 def test_filter_by_date_to(self):
     filtering = {"date_to": date(2010, 1, 1)}
     r = ServiceReport(**filtering)
     stats = normalize_stats(r.get_stats())
     expected = {None: ((u"Počet kontaktů (z toho přímých)", "0 (0)"),)}
     self.assertEqual(stats, expected)
Пример #12
0
 def test_filter_by_date_to(self):
     filtering = {'date_to': date(2010, 1, 1)}
     r = ServiceReport(**filtering)
     stats = normalize_stats(r.get_stats())
     expected = {}
     self.assertEqual(stats, expected)
Пример #13
0
 def test_filter_by_date_to(self):
     filtering = {'date_to': date(2010, 1, 1)}
     r = ServiceReport(**filtering)
     stats = normalize_stats(r.get_stats())
     expected = {}
     self.assertEqual(stats, expected)