mock.sentinel.one

Here are the examples of the python api mock.sentinel.one taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

Example 1

Project: dirigible-spreadsheet Source File: test_calculate.py
    @patch('sheet.calculate.recalculate_cell')
    def test_create_cell_recalculator_should_handle_exceptions_from_recalc_cell(self, mock_recalculate):
        mock_recalculate.side_effect = die()
        unrecalculated_queue = Queue()
        unrecalculated_queue.put(1)
        unrecalculated_queue.task_done = Mock()

        leaf_queue = Queue()
        leaf_queue.put(sentinel.one)
        leaf_queue.task_done = Mock()

        target = create_cell_recalculator(leaf_queue, unrecalculated_queue, sentinel.graph, sentinel.context)
        self.assertRaises(AssertionError, target)

        self.assertTrue(unrecalculated_queue.empty())
        self.assertCalledOnce(unrecalculated_queue.task_done)
        self.assertTrue(leaf_queue.empty())
        self.assertCalledOnce(mock_recalculate, sentinel.one, leaf_queue, sentinel.graph, sentinel.context)
        self.assertCalledOnce(leaf_queue.task_done)

Example 2

Project: pyon Source File: test_transport.py
Function: test_add_on_close_callback
    def test_add_on_close_callback(self):
        tp = AMQPTransport(Mock())
        tp.add_on_close_callback(sentinel.one)
        tp.add_on_close_callback(sentinel.two)

        self.assertEquals(tp._close_callbacks, [sentinel.one, sentinel.two])

Example 3

Project: dirigible-spreadsheet Source File: test_calculate.py
    @patch('sheet.calculate.recalculate_cell')
    def test_create_cell_recalculator_should(self, mock_recalculate):
        unrecalculated_queue = Queue()
        unrecalculated_queue.put(1)
        unrecalculated_queue.put(1)
        unrecalculated_queue.task_done = Mock()

        leaf_queue = Queue()
        leaf_queue.put(sentinel.one)
        leaf_queue.put(sentinel.two)
        leaf_queue.task_done = Mock()

        target = create_cell_recalculator(leaf_queue, unrecalculated_queue, sentinel.graph, sentinel.context)
        target()

        self.assertTrue(unrecalculated_queue.empty())
        self.assertEquals(
            unrecalculated_queue.task_done.call_args_list,
            [ ((), {}), ((), {}), ]
        )

        self.assertTrue(leaf_queue.empty())

        self.assertEquals(
            mock_recalculate.call_args_list,
            [
                ((sentinel.one, leaf_queue, sentinel.graph, sentinel.context), {}),
                ((sentinel.two, leaf_queue, sentinel.graph, sentinel.context), {})
            ]
        )

        self.assertEquals(
            leaf_queue.task_done.call_args_list,
            [ ((), {}), ((), {}), ]
        )

Example 4

Project: pyon Source File: test_procs.py
    def test_is_local_agent_process_not_found(self):
        self.assertFalse(self.pm.is_local_agent_process(sentinel.one))