# Path: stackimpact/utils.py
# def timestamp():
#     return int(time.time())


import unittest
import sys
import json
import stackimpact
from stackimpact.utils import timestamp
from test_server import TestServer
        )

        m = {
            'm1': 1
        }
        agent.message_queue.add('t1', m)

        m = {
            'm2': 2
        }        
        agent.message_queue.add('t1', m)

        agent.message_queue.queue[0]['added_at'] = timestamp() - 20 * 60

        agent.message_queue.flush()

        data = json.loads(server.get_request_data())
        self.assertEqual(data['payload']['messages'][0]['content']['m2'], 2)

        agent.destroy()
        server.join()


    def test_flush_fail(self):
        server = TestServer(5006)
        server.set_response_data("unparsablejson")
        server.start()

        stackimpact._agent = None
        agent = stackimpact.start(

# Path: stackimpact/utils.py
# def timestamp():
#     return int(time.time())


# Path: tests/message_queue_test.py
import unittest
import sys
import json
import stackimpact
from stackimpact.utils import timestamp
from test_server import TestServer

        )

        m = {
            'm1': 1
        }
        agent.message_queue.add('t1', m)

        m = {
            'm2': 2
        }        
        agent.message_queue.add('t1', m)

        agent.message_queue.queue[0]['added_at'] = timestamp() - 20 * 60

        agent.message_queue.flush()

        data = json.loads(server.get_request_data())
        self.assertEqual(data['payload']['messages'][0]['content']['m2'], 2)

        agent.destroy()
        server.join()


    def test_flush_fail(self):
        server = TestServer(5006)
        server.set_response_data("unparsablejson")
        server.start()

        stackimpact._agent = None
        agent = stackimpact.start(

            dashboard_address = 'http://localhost:5006',