'Tests that passing None as the mapping will temporarily
untarget any previously set cell context.'

@mock.patch('nova.rpc.create_transport')
@mock.patch('nova.db.create_context_manager')
def test_target_cell_unset(self, mock_create_ctxt_mgr, mock_rpc):

    mock_create_ctxt_mgr.return_value = mock.sentinel.cdb
    mock_rpc.return_value = mock.sentinel.cmq
    ctxt = context.RequestContext('111', '222', roles=['admin', 'weasel'])
    ctxt.db_connection = mock.sentinel.db_conn
    ctxt.mq_connection = mock.sentinel.mq_conn
    with context.target_cell(ctxt, None) as cctxt:
        self.assertIsNone(cctxt.db_connection)
        self.assertIsNone(cctxt.mq_connection)
    self.assertEqual(mock.sentinel.db_conn, ctxt.db_connection)
    self.assertEqual(mock.sentinel.mq_conn, ctxt.mq_connection)
