Removed statsd from the api and use the statsd in the utils library.

The statsd code was added to the utils library a while ago, uses the
statsd from the util library and therefore consolidates the code into
once place.
This commit is contained in:
Richard Chapman
2018-02-06 09:35:33 +00:00
parent 8696f8995d
commit d855b4e4ec
17 changed files with 18 additions and 79 deletions

View File

@@ -1,24 +0,0 @@
from unittest.mock import ANY
from app.statsd_decorators import statsd
import app
class AnyStringWith(str):
def __eq__(self, other):
return self in other
def test_should_call_statsd(notify_api, mocker):
mocker.patch('app.statsd_client.incr')
mocker.patch('app.statsd_client.timing')
mock_logger = mocker.patch.object(notify_api.logger, 'info')
@statsd(namespace="test")
def test_function():
return True
assert test_function()
app.statsd_client.incr.assert_called_once_with("test.test_function")
app.statsd_client.timing.assert_called_once_with("test.test_function", ANY)
mock_logger.assert_called_once_with(AnyStringWith("test call test_function took "))