def test_get_with_options(self): client = prometheus.PrometheusClient( 'http://localhost:9090/api/v1', auth=('foo', 'bar'), verify='/some/random/path', ) with mock.patch('requests.get') as mock_get: client._get( 'query_range', params={ 'query': 'max(http_requests_total) by (project_id)', 'start': samples.FIRST_PERIOD_BEGIN, 'end': samples.FIRST_PERIOD_END, 'step': 10, }, ) mock_get.assert_called_once_with( 'http://localhost:9090/api/v1/query_range', params={ 'query': 'max(http_requests_total) by (project_id)', 'start': samples.FIRST_PERIOD_BEGIN, 'end': samples.FIRST_PERIOD_END, 'step': 10, }, auth=('foo', 'bar'), verify='/some/random/path', )
def setUp(self): super(PrometheusClientTest, self).setUp() self.client = prometheus.PrometheusClient( 'http://localhost:9090/api/v1', )