(0 . 0)(1 . 32)
345 import unittest
346
347 import time
348 from mock import Mock
349 from lib.commands import BROADCAST
350 from lib.message import Message
351 from lib.getdata import GetData
352 from lib.long_buffer import LongBuffer
353 from lib.order_buffer import OrderBuffer
354 from lib.state import State
355 from lib.direct import Direct
356 import helper
357
358 class TestOrderBuffer(unittest.TestCase):
359 def setUp(self):
360 helper.setup()
361 self.socket = Mock()
362 self.state = State(self.socket)
363 self.state.set_knob('nick', 'alice')
364
365 def test_add(self):
366 m1 = {
367 'command': BROADCAST,
368 'body': "m1",
369 'speaker': "bob",
370 'handle': "alice",
371 'self_chain': 'abc',
372 'net_chain': 'def',
373 'message_hash': '123'
374 }
375 ob = OrderBuffer(self.state)
376 ob.add(m1)