<s> from __future__ import absolute_import <EOL> from mock import patch <EOL> from datadog . util . hostname import get_hostname <EOL> from sentry . metrics . datadog import DatadogMetricsBackend <EOL> from sentry . testutils import TestCase <EOL> class DatadogMetricsBackendTest ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . backend = DatadogMetricsBackend ( prefix = '<STR_LIT>' ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_incr ( self , mock_incr ) : <EOL> self . backend . incr ( '<STR_LIT:foo>' , instance = '<STR_LIT:bar>' ) <EOL> mock_incr . assert_called_once_with ( <EOL> '<STR_LIT>' , <NUM_LIT:1> , <EOL> tags = [ '<STR_LIT>' ] , <EOL> host = get_hostname ( ) , <EOL> ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_timing ( self , mock_timing ) : <EOL> self . backend . timing ( '<STR_LIT:foo>' , <NUM_LIT:30> , instance = '<STR_LIT:bar>' ) <EOL> mock_timing . assert_called_once_with ( <EOL> '<STR_LIT>' , <NUM_LIT:30> , <EOL> sample_rate = <NUM_LIT:1> , <EOL> tags = [ '<STR_LIT>' ] , <EOL> host = get_hostname ( ) , <EOL> ) </s>
