Exemplo n.º 1
0
    def test_halt(self):
        # test
        queue = RequestQueue(Mock())
        queue.halt()

        # validation
        self.assertTrue(queue._halted)
Exemplo n.º 2
0
    def test_halt(self):
        # test
        queue = RequestQueue(Mock(), Mock())
        queue.halt()

        # validation
        self.assertTrue(queue._halted)
Exemplo n.º 3
0
    def test_get_halted(self, fake_queue):
        # test
        queue = RequestQueue(Mock(), Mock())
        queue.halt()
        item = queue.get()

        # validation
        self.assertFalse(fake_queue().get.called)
        self.assertEqual(item, None)
Exemplo n.º 4
0
    def test_put_halted(self, fake_queue):
        # test
        item = Mock()
        queue = RequestQueue(Mock(), Mock())
        queue.halt()
        queue.put(item)

        # validation
        self.assertFalse(fake_queue().put.called)
Exemplo n.º 5
0
    def test_get_halted(self, fake_queue):
        # test
        queue = RequestQueue(Mock())
        queue.halt()
        item = queue.get()

        # validation
        self.assertFalse(fake_queue().get.called)
        self.assertEqual(item, None)
Exemplo n.º 6
0
    def test_put_halted(self, fake_queue):
        # test
        item = Mock()
        queue = RequestQueue(Mock())
        queue.halt()
        queue.put(item)

        # validation
        self.assertFalse(fake_queue().put.called)
Exemplo n.º 7
0
    def test_halt(self):
        canceled = Mock()
        canceled.is_set.return_value = False

        # test
        queue = RequestQueue(canceled, Mock())
        queue.halt()

        # validation
        self.assertTrue(queue._halted)
Exemplo n.º 8
0
    def test_halt(self):
        canceled = Mock()
        canceled.is_set.return_value = False

        # test
        queue = RequestQueue(canceled, Mock())
        queue.halt()

        # validation
        self.assertTrue(queue._halted)
Exemplo n.º 9
0
    def test_get_halted(self, fake_queue):
        canceled = Mock()
        canceled.is_set.return_value = False

        # test
        queue = RequestQueue(canceled, Mock())
        queue.halt()
        item = queue.get()

        # validation
        self.assertFalse(fake_queue().get.called)
        self.assertEqual(item, None)
Exemplo n.º 10
0
    def test_put_halted(self, fake_queue):
        canceled = Mock()
        canceled.is_set.return_value = False

        # test
        item = Mock()
        queue = RequestQueue(canceled, Mock())
        queue.halt()
        queue.put(item)

        # validation
        self.assertFalse(fake_queue().put.called)
Exemplo n.º 11
0
    def test_get_halted(self, fake_queue):
        canceled = Mock()
        canceled.is_set.return_value = False

        # test
        queue = RequestQueue(canceled, Mock())
        queue.halt()
        item = queue.get()

        # validation
        self.assertFalse(fake_queue().get.called)
        self.assertEqual(item, None)
Exemplo n.º 12
0
    def test_put_halted(self, fake_queue):
        canceled = Mock()
        canceled.is_set.return_value = False

        # test
        item = Mock()
        queue = RequestQueue(canceled, Mock())
        queue.halt()
        queue.put(item)

        # validation
        self.assertFalse(fake_queue().put.called)