def test_scalyr_count(monkeypatch, fx_count): kwargs, res, exp = fx_count kwargs.update({'align': 30}) read_key = '123' post = MagicMock() post.return_value.json.return_value = res monkeypatch.setattr('requests.post', post) scalyr = ScalyrWrapper(read_key) count = scalyr.count(**kwargs) assert count == exp query = get_query('facet', kwargs.get('function', 'count'), read_key, **kwargs) query.pop('queryType') final_q = { 'token': query.pop('token'), 'queries': [query] } post.assert_called_with( scalyr._ScalyrWrapper__timeseries_url, json=final_q, headers={'Content-Type': 'application/json'})
def test_scalyr_count(monkeypatch, fx_count): kwargs, res, exp = fx_count kwargs.update({'align': 30}) read_key = '123' post = MagicMock() post.return_value.json.return_value = res monkeypatch.setattr('requests.post', post) scalyr = ScalyrWrapper(read_key) count = scalyr.count(**kwargs) assert count == exp query = get_query('facet', kwargs.get('function', 'count'), read_key, **kwargs) query.pop('queryType') final_q = {'token': query.pop('token'), 'queries': [query]} post.assert_called_with(scalyr._ScalyrWrapper__timeseries_url, json=final_q, headers={'Content-Type': 'application/json'})
def test_scalyr_count(monkeypatch, fx_count): kwargs, res, exp = fx_count read_key = '123' post = MagicMock() post.return_value.json.return_value = res monkeypatch.setattr('requests.post', post) scalyr = ScalyrWrapper(read_key) count = scalyr.count(**kwargs) assert count == exp query = get_query('numeric', 'count', read_key, **kwargs) post.assert_called_with( scalyr._ScalyrWrapper__numeric_url, json=query, headers={'Content-Type': 'application/json'})