def test_lbsi_count_category_should_not_limit_if_not_specified(self):
     reporter = IndicadorsDataReporter(
         self.client, context=Mock(translate=lambda msgid: ''))
     count_indicator = 10
     indicadors = reporter.list_by_service_id(
         'mock-id', count_indicator=count_indicator)
     self.assertEqual(len(indicadors), 10)
 def test_lbsi_count_category_should_not_limit_if_not_specified(self):
     reporter = IndicadorsDataReporter(
         self.client, context=Mock(translate=lambda msgid: ''))
     count_indicator = 10
     indicadors = reporter.list_by_service_id(
         'mock-id', count_indicator=count_indicator)
     self.assertEqual(len(indicadors), 10)
 def test_lbsi_count_category_should_not_limit_if_count_indicator_is_more_restrictive(self):
     reporter = IndicadorsDataReporter(
         self.client, context=Mock(translate=lambda msgid: ''))
     count_indicator = 1
     count_category = 4
     indicators = reporter.list_by_service_id(
         'mock-id',
         count_indicator=count_indicator, count_category=count_category)
     total_categories = sum(
         [len(indicator['categories']) for indicator in indicators])
     self.assertEqual(count_indicator, len(indicators))
     self.assertLess(total_categories, count_category)
 def test_lbsi_count_category_should_limit_if_specified(self):
     reporter = IndicadorsDataReporter(
         self.client, context=Mock(translate=lambda msgid: ''))
     count_indicator = 10
     for count_category in (1, 3, 4):
         indicators = reporter.list_by_service_id(
             'mock-id',
             count_indicator=count_indicator, count_category=count_category)
         total_indicators = len(indicators)
         total_categories = sum(
             [len(indicator['categories']) for indicator in indicators])
         self.assertEqual(math.ceil(count_category / 3.0), total_indicators)
         self.assertEqual(count_category, total_categories)
 def test_lbsi_count_category_should_not_limit_if_count_indicator_is_more_restrictive(
         self):
     reporter = IndicadorsDataReporter(
         self.client, context=Mock(translate=lambda msgid: ''))
     count_indicator = 1
     count_category = 4
     indicators = reporter.list_by_service_id(
         'mock-id',
         count_indicator=count_indicator,
         count_category=count_category)
     total_categories = sum(
         [len(indicator['categories']) for indicator in indicators])
     self.assertEqual(count_indicator, len(indicators))
     self.assertLess(total_categories, count_category)
 def test_lbsi_count_category_should_limit_if_specified(self):
     reporter = IndicadorsDataReporter(
         self.client, context=Mock(translate=lambda msgid: ''))
     count_indicator = 10
     for count_category in (1, 3, 4):
         indicators = reporter.list_by_service_id(
             'mock-id',
             count_indicator=count_indicator,
             count_category=count_category)
         total_indicators = len(indicators)
         total_categories = sum(
             [len(indicator['categories']) for indicator in indicators])
         self.assertEqual(math.ceil(count_category / 3.0), total_indicators)
         self.assertEqual(count_category, total_categories)