'Test normal usage of collecting custom metrics and reporting to New Relic'

@patch('newrelic.agent')
def test_custom_metrics_with_new_relic(self, mock_newrelic_agent):

    monitoring_utils.accumulate('hello', 10)
    monitoring_utils.accumulate('world', 10)
    monitoring_utils.accumulate('world', 10)
    monitoring_utils.increment('foo')
    monitoring_utils.increment('foo')
    nr_agent_calls_expected = [call('hello', 10), call('world', 20), call('foo', 2)]
    MonitoringCustomMetrics().process_response('fake    request', 'fake    response')
    expected_call_count = len(nr_agent_calls_expected)
    measured_call_count = mock_newrelic_agent.add_custom_parameter.call_count
    self.assertEqual(expected_call_count, measured_call_count)
    mock_newrelic_agent.add_custom_parameter.has_calls(nr_agent_calls_expected, any_order=True)
