'Test worker creation when a worker for the resource exists.'

@mock.patch('cinder.db.worker_update', autospec=True)
@mock.patch('cinder.db.worker_create', autospec=True)
def test_create_worker_already_exists(self, mock_create, mock_update):

    rpc.LAST_OBJ_VERSIONS[Backup.get_rpc_api().BINARY] = '1.3'
    mock_create.side_effect = exception.WorkerExists(type='type', id='id')
    backup = Backup(_context=self.context, status='cleanable', id=mock.sentinel.id)
    res = backup.create_worker()
    self.assertTrue(res)
    self.assertTrue(mock_create.called)
    mock_update.assert_called_once_with(self.context, None, filters={'resource_type': 'Backup', 'resource_id': mock.sentinel.id}, service_id=None, status='cleanable')
