class MemoryQueueTest(CommonQueueTestsMixin, unittest.TestCase):
    
    def setUp(self):
        self.store = MemoryQueue()
        
    def test_dequeue_identity(self):
        """ Test the dequeue() method. """
        dest = '/queue/foo'
        frame = StompFrame('MESSAGE', headers={'message-id': str(uuid.uuid4())}, body='some data') 
        self.store.enqueue(dest, frame)
        
        assert self.store.has_frames(dest) == True
        assert self.store.size(dest) == 1
        
        rframe = self.store.dequeue(dest)
        assert frame == rframe
        assert frame is rframe # Currently we expect these to be the /same/ object.  
        
        assert self.store.has_frames(dest) == False
        assert self.store.size(dest) == 0
        
Exemplo n.º 2
0
class MemoryQueueTest(CommonQueueTestsMixin, unittest.TestCase):
    def setUp(self):
        self.store = MemoryQueue()

    def test_dequeue_identity(self):
        """ Test the dequeue() method. """
        dest = '/queue/foo'
        frame = StompFrame('MESSAGE',
                           headers={'message-id': str(uuid.uuid4())},
                           body='some data')
        self.store.enqueue(dest, frame)

        assert self.store.has_frames(dest) == True
        assert self.store.size(dest) == 1

        rframe = self.store.dequeue(dest)
        assert frame == rframe
        assert frame is rframe  # Currently we expect these to be the /same/ object.

        assert self.store.has_frames(dest) == False
        assert self.store.size(dest) == 0
Exemplo n.º 3
0
class MemoryQueueTest(CommonQueueTest, unittest.TestCase):
    def setUp(self):
        self.store = MemoryQueue()

    def test_dequeue_identity(self):
        """ Test the dequeue() method. """
        dest = '/queue/foo'
        frame = Frame('MESSAGE',
                      headers={'message-id': str(uuid.uuid4())},
                      body='some data')
        self.store.enqueue(dest, frame)

        self.assertTrue(self.store.has_frames(dest))
        self.assertEqual(self.store.size(dest), 1)

        rframe = self.store.dequeue(dest)
        self.assertEqual(frame, rframe)
        # Currently we expect these to be the /same/ object.
        self.assertIs(frame, rframe)

        self.assertFalse(self.store.has_frames(dest))
        self.assertEqual(self.store.size(dest), 0)
Exemplo n.º 4
0
class MemoryQueueTest(CommonQueueTest, unittest.TestCase):

    def setUp(self):
        self.store = MemoryQueue()

    def test_dequeue_identity(self):
        """ Test the dequeue() method. """
        dest = '/queue/foo'
        frame = Frame('MESSAGE', headers={
                      'message-id': str(uuid.uuid4())}, body='some data')
        self.store.enqueue(dest, frame)

        self.assertTrue(self.store.has_frames(dest))
        self.assertEqual(self.store.size(dest), 1)

        rframe = self.store.dequeue(dest)
        self.assertEqual(frame, rframe)
        # Currently we expect these to be the /same/ object.
        self.assertIs(frame, rframe)

        self.assertFalse(self.store.has_frames(dest))
        self.assertEqual(self.store.size(dest), 0)