def test_flushes(self, graphite):
        """
        Tests that metrics are properly flushed to a graphite server.
        """
        store = GraphiteStore(graphite.host, graphite.port, prefix="foobar")
        metrics = [("k", 1, 10), ("j", 2, 20)]

        # Flush the metrics and verify that graphite sees the
        # proper results
        store.flush(metrics)
        store.close()

        # Check that we get the proper results after a specific
        # flush interval to give the test time to send the data
        def check():
            metric_strings = ["foobar.%s %s %s" % metric for metric in metrics]
            assert metric_strings == graphite.messages

        self.after_flush_interval(check, interval=1)
dataset/ETHPy150Open kiip/statsite/tests/unit/test_metrics_store.py/TestGraphiteStore.test_flushes/original