コード例 #1
0
    def test_save_processed(self):
        config = self.setup_config()
        number_of_calls = 10

        with patch('collector.external.statsd.dogstatsd.statsd') as statsd_obj:
            cs = StatsdCrashStorage(config)
            for x in range(number_of_calls):
                cs.save_processed(x, {})

            statsd_obj.increment.assert_has_calls(
                [call('save_processed') for x in range(number_of_calls)])
コード例 #2
0
    def test_arbitrary_with_prefix(self):
        config = self.setup_config()
        config.statsd_prefix = 'processor'
        number_of_calls = 10

        with patch('collector.external.statsd.dogstatsd.statsd') as statsd_obj:
            cs = StatsdCrashStorage(config)
            for x in range(number_of_calls):
                cs.some_random_method(x, {})

            # the method is not in the active list so should be ignored
            statsd_obj.increment.assert_has_calls([])
コード例 #3
0
    def test_arbitrary_with_prefix(self):
        config = self.setup_config()
        config.statsd_prefix = 'processor'
        number_of_calls =  10

        with patch('collector.external.statsd.dogstatsd.statsd') as statsd_obj:
            cs =  StatsdCrashStorage(config)
            for x in range(number_of_calls):
                cs.some_random_method(x, {})

            # the method is not in the active list so should be ignored
            statsd_obj.increment.assert_has_calls([])
コード例 #4
0
    def test_save_processed(self):
        config = self.setup_config()
        number_of_calls =  10

        with patch('collector.external.statsd.dogstatsd.statsd') as statsd_obj:
            cs =  StatsdCrashStorage(config)
            for x in range(number_of_calls):
                cs.save_processed(x, {})

            statsd_obj.increment.assert_has_calls(
                [call('save_processed') for x in range(number_of_calls)]
            )