import unittest import time from mock import Mock from lib.commands import BROADCAST from lib.message import Message from lib.getdata import GetData from lib.long_buffer import LongBuffer from lib.order_buffer import OrderBuffer from lib.state import State from lib.direct import Direct import helper class TestOrderBuffer(unittest.TestCase): def setUp(self): helper.setup() self.socket = Mock() self.state = State(self.socket) self.state.set_knob('nick', 'alice') def test_add(self): m1 = { 'command': BROADCAST, 'body': "m1", 'speaker': "bob", 'handle': "alice", 'self_chain': 'abc', 'net_chain': 'def', 'message_hash': '123' } ob = OrderBuffer(self.state) ob.add(m1)