Beispiel #1
0
    def test_custom_indicators_limited(self, mock):
        expected = {}

        # custom
        expected.update(
            get_indicators('motherForms', [3, None, 9, None],
                           is_legacy=True,
                           limit_ranges=[WEEK0, MONTH0]))
        expected.update(
            get_indicators('childForms', [None, 0, None, None],
                           is_legacy=True,
                           limit_ranges=[WEEK1]))
        expected.update(
            get_indicators('motherDuration', [None, None, None, 0],
                           is_legacy=True,
                           limit_ranges=[MONTH1]))

        indicator_config = CallCenterIndicatorConfig()
        indicator_config.custom_form = [
            TypedIndicator(type='motherForms', date_range=WEEK0),
            TypedIndicator(type='motherForms', date_range=MONTH0),
            TypedIndicator(type='childForms', date_range=WEEK1),
            TypedIndicator(type='motherDuration', date_range=MONTH1),
        ]
        indicator_set = CallCenterIndicators(
            self.aarohi_domain.name,
            self.aarohi_domain.default_timezone,
            self.aarohi_domain.call_center_config.case_type,
            self.aarohi_user,
            custom_cache=locmem_cache,
            indicator_config=indicator_config)
        self._test_indicators(self.aarohi_user, indicator_set.get_data(),
                              expected)
Beispiel #2
0
    def test_custom_indicators_limited(self, mock):
        expected = {}

        # custom
        expected.update(
            get_indicators('motherForms', [3, None, 9, None], is_legacy=True, limit_ranges=[WEEK0, MONTH0])
        )
        expected.update(
            get_indicators('childForms', [None, 0, None, None], is_legacy=True, limit_ranges=[WEEK1])
        )
        expected.update(
            get_indicators('motherDuration', [None, None, None, 0], is_legacy=True, limit_ranges=[MONTH1])
        )

        indicator_config = CallCenterIndicatorConfig()
        indicator_config.custom_form = [
            TypedIndicator(type='motherForms', date_range=WEEK0),
            TypedIndicator(type='motherForms', date_range=MONTH0),
            TypedIndicator(type='childForms', date_range=WEEK1),
            TypedIndicator(type='motherDuration', date_range=MONTH1),
        ]
        indicator_set = CallCenterIndicators(
            self.aarohi_domain.name,
            self.aarohi_domain.default_timezone,
            self.aarohi_domain.call_center_config.case_type,
            self.aarohi_user,
            custom_cache=locmem_cache,
            indicator_config=indicator_config
        )
        self._test_indicators(
            self.aarohi_user,
            indicator_set.get_data(),
            expected
        )
Beispiel #3
0
        # custom
        expected.update(
            get_indicators('motherForms', [3L, None, 9L, None], is_legacy=True, limit_ranges=[WEEK0, MONTH0])
        )
        expected.update(
            get_indicators('childForms', [None, 0L, None, None], is_legacy=True, limit_ranges=[WEEK1])
        )
        expected.update(
            get_indicators('motherDuration', [None, None, None, 0L], is_legacy=True, limit_ranges=[MONTH1])
        )

        indicator_config = CallCenterIndicatorConfig()
        indicator_config.custom_form = [
            TypedIndicator(type='motherForms', date_range=WEEK0),
            TypedIndicator(type='motherForms', date_range=MONTH0),
            TypedIndicator(type='childForms', date_range=WEEK1),
            TypedIndicator(type='motherDuration', date_range=MONTH1),
        ]
        indicator_set = CallCenterIndicators(
            self.aarohi_domain.name,
            self.aarohi_domain.default_timezone,
            self.aarohi_domain.call_center_config.case_type,
            self.aarohi_user,
            custom_cache=locmem_cache,
            indicator_config=indicator_config
        )
        self._test_indicators(
            self.aarohi_user,
            indicator_set.get_data(),
            expected
        )
            get_indicators('motherForms', [3L, None, 9L, None],
                           is_legacy=True,
                           limit_ranges=[WEEK0, MONTH0]))
        expected.update(
            get_indicators('childForms', [None, 0L, None, None],
                           is_legacy=True,
                           limit_ranges=[WEEK1]))
        expected.update(
            get_indicators('motherDuration', [None, None, None, 0L],
                           is_legacy=True,
                           limit_ranges=[MONTH1]))

        indicator_config = CallCenterIndicatorConfig()
        indicator_config.custom_form = [
            TypedIndicator(type='motherForms', date_range=WEEK0),
            TypedIndicator(type='motherForms', date_range=MONTH0),
            TypedIndicator(type='childForms', date_range=WEEK1),
            TypedIndicator(type='motherDuration', date_range=MONTH1),
        ]
        indicator_set = CallCenterIndicators(
            self.aarohi_domain.name,
            self.aarohi_domain.default_timezone,
            self.aarohi_domain.call_center_config.case_type,
            self.aarohi_user,
            custom_cache=locmem_cache,
            indicator_config=indicator_config)
        self._test_indicators(self.aarohi_user, indicator_set.get_data(),
                              expected)

    def test_caching(self, mock):
        user_case = (CaseAccessors(
            self.cc_domain.name).get_case_by_domain_hq_user_id(