def test_http_status(self): line = '127.0.0.1 - - [02/Jul/2015:14:49:48 +0000] "GET /basic_status HTTP/1.1" 200 110 "-" ' + \ '"python-requests/2.2.1 CPython/2.7.6 Linux/3.13.0-48-generic"' # run single method collector = NginxAccessLogsCollector(object=self.fake_object, tail=[]) collector.http_status(NginxAccessLogParser().parse(line)) # check metrics = self.fake_object.statsd.current assert_that(metrics, has_item('counter')) counters = metrics['counter'] assert_that(counters, has_item('nginx.http.status.2xx')) assert_that(counters['nginx.http.status.2xx'][0][1], equal_to(1))