# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

import random

from cryptography import fernet
import mock
from oslo_db import exception as odb_exceptions
from oslo_utils import uuidutils
from sqlalchemy.orm import exc
from taskflow.types import failure

from octavia.common import constants
from octavia.common import data_models
from octavia.common import utils
from octavia.controller.worker.v2.tasks import database_tasks
from octavia.db import repositories as repo
import octavia.tests.unit.base as base


AMP_ID = uuidutils.generate_uuid()
COMPUTE_ID = uuidutils.generate_uuid()
LB_ID = uuidutils.generate_uuid()
SERVER_GROUP_ID = uuidutils.generate_uuid()
LB_NET_IP = '192.0.2.2'
LISTENER_ID = uuidutils.generate_uuid()
POOL_ID = uuidutils.generate_uuid()
HM_ID = uuidutils.generate_uuid()
MEMBER_ID = uuidutils.generate_uuid()
PORT_ID = uuidutils.generate_uuid()
SUBNET_ID = uuidutils.generate_uuid()
VRRP_PORT_ID = uuidutils.generate_uuid()
HA_PORT_ID = uuidutils.generate_uuid()
L7POLICY_ID = uuidutils.generate_uuid()
L7RULE_ID = uuidutils.generate_uuid()
VIP_IP = '192.0.5.2'
VRRP_IP = '192.0.5.3'
HA_IP = '192.0.5.4'
AMP_ROLE = 'FAKE_ROLE'
VRRP_ID = random.randrange(255)
VRRP_PRIORITY = random.randrange(100)
CACHED_ZONE = 'zone1'
IMAGE_ID = uuidutils.generate_uuid()
COMPUTE_FLAVOR = uuidutils.generate_uuid()

_amphora_mock = mock.MagicMock()
_amphora_mock.id = AMP_ID
_amphora_mock.compute_id = COMPUTE_ID
_amphora_mock.lb_network_ip = LB_NET_IP
_amphora_mock.vrrp_ip = VRRP_IP
_amphora_mock.ha_ip = HA_IP
_amphora_mock.ha_port_id = HA_PORT_ID
_amphora_mock.vrrp_port_id = VRRP_PORT_ID
_amphora_mock.role = AMP_ROLE
_amphora_mock.vrrp_id = VRRP_ID
_amphora_mock.vrrp_priority = VRRP_PRIORITY
_amphorae = [_amphora_mock]
_loadbalancer_mock = mock.MagicMock()
_loadbalancer_mock.id = LB_ID
_loadbalancer_mock.amphorae = [_amphora_mock]
_l7policy_mock = mock.MagicMock()
_l7policy_mock.id = L7POLICY_ID
_l7rule_mock = mock.MagicMock()
_l7rule_mock.id = L7RULE_ID
_listener_mock = mock.MagicMock()
_listener_to_dict_mock = mock.MagicMock(
    return_value={'id': LISTENER_ID})
_listener_mock.id = LISTENER_ID
_listener_mock.to_dict = _listener_to_dict_mock
_tf_failure_mock = mock.Mock(spec=failure.Failure)
_vip_mock = mock.MagicMock()
_vip_mock.port_id = PORT_ID
_vip_mock.subnet_id = SUBNET_ID
_vip_mock.ip_address = VIP_IP
_vrrp_group_mock = mock.MagicMock()
_cert_mock = mock.MagicMock()
_compute_mock = mock.MagicMock()
_compute_mock.lb_network_ip = LB_NET_IP
_compute_mock.cached_zone = CACHED_ZONE
_compute_mock.image_id = IMAGE_ID
_compute_mock.compute_flavor = COMPUTE_FLAVOR


@mock.patch('octavia.db.repositories.AmphoraRepository.delete')
@mock.patch('octavia.db.repositories.AmphoraRepository.update')
@mock.patch('octavia.db.repositories.ListenerRepository.update')
@mock.patch('octavia.db.repositories.LoadBalancerRepository.update')
@mock.patch('octavia.db.api.get_session', return_value='TEST')
@mock.patch('octavia.controller.worker.v2.tasks.database_tasks.LOG')
@mock.patch('oslo_utils.uuidutils.generate_uuid', return_value=AMP_ID)
class TestDatabaseTasks(base.TestCase):

    def setUp(self):

        self.health_mon_mock = mock.MagicMock()
        self.health_mon_mock.id = HM_ID
        self.health_mon_mock.pool_id = POOL_ID

        self.listener_mock = mock.MagicMock()
        self.listener_mock.id = LISTENER_ID

        self.loadbalancer_mock = mock.MagicMock()
        self.loadbalancer_mock.id = LB_ID

        self.member_mock = mock.MagicMock()
        self.member_mock.id = MEMBER_ID

        self.db_pool_mock = mock.MagicMock()
        self.db_pool_mock.id = POOL_ID
        self.db_pool_mock.health_monitor = self.health_mon_mock

        self.member_mock = {
            constants.MEMBER_ID: MEMBER_ID,
            constants.POOL_ID: POOL_ID,
        }

        self.l7policy_mock = mock.MagicMock()
        self.l7policy_mock.id = L7POLICY_ID

        self.l7rule_mock = mock.MagicMock()
        self.l7rule_mock.id = L7RULE_ID
        self.l7rule_mock.l7policy = self.l7policy_mock

        super(TestDatabaseTasks, self).setUp()

    @mock.patch('octavia.db.repositories.AmphoraRepository.create',
                return_value=_amphora_mock)
    def test_create_amphora_in_db(self,
                                  mock_create,
                                  mock_generate_uuid,
                                  mock_LOG,
                                  mock_get_session,
                                  mock_loadbalancer_repo_update,
                                  mock_listener_repo_update,
                                  mock_amphora_repo_update,
                                  mock_amphora_repo_delete):

        create_amp_in_db = database_tasks.CreateAmphoraInDB()
        amp_id = create_amp_in_db.execute()

        repo.AmphoraRepository.create.assert_called_once_with(
            'TEST',
            id=AMP_ID,
            status=constants.PENDING_CREATE,
            cert_busy=False)

        self.assertEqual(_amphora_mock.id, amp_id)

        # Test the revert
        create_amp_in_db.revert(_tf_failure_mock)
        self.assertFalse(mock_amphora_repo_delete.called)

        mock_amphora_repo_delete.reset_mock()
        create_amp_in_db.revert(result='AMP')
        self.assertTrue(mock_amphora_repo_delete.called)
        mock_amphora_repo_delete.assert_called_once_with(
            'TEST',
            id='AMP')

        # Test revert with exception
        mock_amphora_repo_delete.reset_mock()
        mock_amphora_repo_delete.side_effect = Exception('fail')
        create_amp_in_db.revert(result='AMP')
        self.assertTrue(mock_amphora_repo_delete.called)
        mock_amphora_repo_delete.assert_called_once_with(
            'TEST',
            id='AMP')

    @mock.patch('octavia.db.repositories.ListenerRepository.delete')
    def test_delete_listener_in_db(self,
                                   mock_listener_repo_delete,
                                   mock_generate_uuid,
                                   mock_LOG,
                                   mock_get_session,
                                   mock_loadbalancer_repo_update,
                                   mock_listener_repo_update,
                                   mock_amphora_repo_update,
                                   mock_amphora_repo_delete):

        delete_listener = database_tasks.DeleteListenerInDB()
        delete_listener.execute({constants.LISTENER_ID: LISTENER_ID})

        repo.ListenerRepository.delete.assert_called_once_with(
            'TEST',
            id=LISTENER_ID)

        # Test the revert
        repo.ListenerRepository.delete.reset_mock()
        delete_listener.revert({constants.LISTENER_ID: LISTENER_ID})
        repo.ListenerRepository.delete.assert_not_called()

    @mock.patch('octavia.db.repositories.HealthMonitorRepository.update')
    @mock.patch('octavia.db.repositories.HealthMonitorRepository.delete')
    def test_delete_health_monitor_in_db(self,
                                         mock_health_mon_repo_delete,
                                         mock_health_mon_repo_update,
                                         mock_generate_uuid,
                                         mock_LOG,
                                         mock_get_session,
                                         mock_loadbalancer_repo_update,
                                         mock_listener_repo_update,
                                         mock_amphora_repo_update,
                                         mock_amphora_repo_delete):

        delete_health_mon = database_tasks.DeleteHealthMonitorInDB()
        delete_health_mon.execute(self.health_mon_mock)

        repo.HealthMonitorRepository.delete.assert_called_once_with(
            'TEST', id=HM_ID)

        # Test the revert
        mock_health_mon_repo_delete.reset_mock()
        delete_health_mon.revert(self.health_mon_mock)

        repo.HealthMonitorRepository.update.assert_called_once_with(
            'TEST', id=HM_ID, provisioning_status=constants.ERROR)

        # Test Not Found Exception
        mock_health_mon_repo_delete.reset_mock()
        mock_health_mon_repo_delete.side_effect = [exc.NoResultFound()]
        delete_health_mon.execute(self.health_mon_mock)

        repo.HealthMonitorRepository.delete.assert_called_once_with(
            'TEST', id=HM_ID)

    @mock.patch('octavia.db.repositories.HealthMonitorRepository.update')
    @mock.patch('octavia.db.repositories.HealthMonitorRepository.delete')
    def test_delete_health_monitor_in_db_by_pool(self,
                                                 mock_health_mon_repo_delete,
                                                 mock_health_mon_repo_update,
                                                 mock_generate_uuid,
                                                 mock_LOG,
                                                 mock_get_session,
                                                 mock_loadbalancer_repo_update,
                                                 mock_listener_repo_update,
                                                 mock_amphora_repo_update,
                                                 mock_amphora_repo_delete):

        delete_health_mon = database_tasks.DeleteHealthMonitorInDBByPool()
        delete_health_mon.execute(self.db_pool_mock)

        repo.HealthMonitorRepository.delete.assert_called_once_with(
            'TEST',
            id=HM_ID)

        # Test the revert
        mock_health_mon_repo_delete.reset_mock()
        delete_health_mon.revert(self.db_pool_mock)

        repo.HealthMonitorRepository.update.assert_called_once_with(
            'TEST', id=HM_ID, provisioning_status=constants.ERROR)

# TODO(johnsom) fix once provisioning status added
#        repo.HealthMonitorRepository.update.assert_called_once_with(
#            'TEST',
#            POOL_ID,
#            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.MemberRepository.delete')
    def test_delete_member_in_db(self,
                                 mock_member_repo_delete,
                                 mock_generate_uuid,
                                 mock_LOG,
                                 mock_get_session,
                                 mock_loadbalancer_repo_update,
                                 mock_listener_repo_update,
                                 mock_amphora_repo_update,
                                 mock_amphora_repo_delete):

        delete_member = database_tasks.DeleteMemberInDB()
        delete_member.execute(self.member_mock)

        repo.MemberRepository.delete.assert_called_once_with(
            'TEST',
            id=MEMBER_ID)

        # Test the revert

        mock_member_repo_delete.reset_mock()
        delete_member.revert(self.member_mock)

# TODO(johnsom) Fix
#        repo.MemberRepository.delete.assert_called_once_with(
#            'TEST',
#            MEMBER_ID)

    @mock.patch('octavia.db.repositories.PoolRepository.delete')
    def test_delete_pool_in_db(self,
                               mock_pool_repo_delete,
                               mock_generate_uuid,
                               mock_LOG,
                               mock_get_session,
                               mock_loadbalancer_repo_update,
                               mock_listener_repo_update,
                               mock_amphora_repo_update,
                               mock_amphora_repo_delete):

        delete_pool = database_tasks.DeletePoolInDB()
        delete_pool.execute(POOL_ID)

        repo.PoolRepository.delete.assert_called_once_with(
            'TEST',
            id=POOL_ID)

        # Test the revert

        mock_pool_repo_delete.reset_mock()
        delete_pool.revert(POOL_ID)

# TODO(johnsom) Fix
#        repo.PoolRepository.update.assert_called_once_with(
#            'TEST',
#            POOL_ID,
#            operating_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.L7PolicyRepository.delete')
    def test_delete_l7policy_in_db(self,
                                   mock_l7policy_repo_delete,
                                   mock_generate_uuid,
                                   mock_LOG,
                                   mock_get_session,
                                   mock_loadbalancer_repo_update,
                                   mock_listener_repo_update,
                                   mock_amphora_repo_update,
                                   mock_amphora_repo_delete):

        delete_l7policy = database_tasks.DeleteL7PolicyInDB()
        delete_l7policy.execute(_l7policy_mock)

        repo.L7PolicyRepository.delete.assert_called_once_with(
            'TEST',
            id=L7POLICY_ID)

        # Test the revert

        mock_l7policy_repo_delete.reset_mock()
        delete_l7policy.revert(_l7policy_mock)

# TODO(sbalukoff) Fix
#        repo.ListenerRepository.update.assert_called_once_with(
#            'TEST',
#            LISTENER_ID,
#            operating_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.L7RuleRepository.delete')
    def test_delete_l7rule_in_db(self,
                                 mock_l7rule_repo_delete,
                                 mock_generate_uuid,
                                 mock_LOG,
                                 mock_get_session,
                                 mock_loadbalancer_repo_update,
                                 mock_listener_repo_update,
                                 mock_amphora_repo_update,
                                 mock_amphora_repo_delete):

        delete_l7rule = database_tasks.DeleteL7RuleInDB()
        delete_l7rule.execute(_l7rule_mock)

        repo.L7RuleRepository.delete.assert_called_once_with(
            'TEST',
            id=L7RULE_ID)

        # Test the revert

        mock_l7rule_repo_delete.reset_mock()
        delete_l7rule.revert(_l7rule_mock)

# TODO(sbalukoff) Fix
#        repo.ListenerRepository.update.assert_called_once_with(
#            'TEST',
#            LISTENER_ID,
#            operating_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.AmphoraRepository.get',
                return_value=_amphora_mock)
    def test_reload_amphora(self,
                            mock_amp_get,
                            mock_generate_uuid,
                            mock_LOG,
                            mock_get_session,
                            mock_loadbalancer_repo_update,
                            mock_listener_repo_update,
                            mock_amphora_repo_update,
                            mock_amphora_repo_delete):

        reload_amp = database_tasks.ReloadAmphora()
        amp = reload_amp.execute(AMP_ID)

        repo.AmphoraRepository.get.assert_called_once_with(
            'TEST',
            id=AMP_ID)

        self.assertEqual(_amphora_mock, amp)

    @mock.patch('octavia.db.repositories.LoadBalancerRepository.get',
                return_value=_loadbalancer_mock)
    def test_reload_load_balancer(self,
                                  mock_lb_get,
                                  mock_generate_uuid,
                                  mock_LOG,
                                  mock_get_session,
                                  mock_loadbalancer_repo_update,
                                  mock_listener_repo_update,
                                  mock_amphora_repo_update,
                                  mock_amphora_repo_delete):

        reload_lb = database_tasks.ReloadLoadBalancer()
        lb = reload_lb.execute(LB_ID)

        repo.LoadBalancerRepository.get.assert_called_once_with(
            'TEST',
            id=LB_ID)

        self.assertEqual(_loadbalancer_mock, lb)

    @mock.patch('octavia.db.repositories.LoadBalancerRepository.get',
                return_value=_loadbalancer_mock)
    @mock.patch('octavia.db.repositories.VipRepository.update')
    def test_update_vip_after_allocation(self,
                                         mock_vip_update,
                                         mock_loadbalancer_get,
                                         mock_generate_uuid,
                                         mock_LOG,
                                         mock_get_session,
                                         mock_loadbalancer_repo_update,
                                         mock_listener_repo_update,
                                         mock_amphora_repo_update,
                                         mock_amphora_repo_delete):

        update_vip = database_tasks.UpdateVIPAfterAllocation()
        loadbalancer = update_vip.execute(LB_ID, _vip_mock)

        self.assertEqual(_loadbalancer_mock, loadbalancer)
        mock_vip_update.assert_called_once_with('TEST',
                                                LB_ID,
                                                port_id=PORT_ID,
                                                subnet_id=SUBNET_ID,
                                                ip_address=VIP_IP)
        mock_loadbalancer_get.assert_called_once_with('TEST',
                                                      id=LB_ID)

    def test_update_amphora_vip_data(self,
                                     mock_generate_uuid,
                                     mock_LOG,
                                     mock_get_session,
                                     mock_loadbalancer_repo_update,
                                     mock_listener_repo_update,
                                     mock_amphora_repo_update,
                                     mock_amphora_repo_delete):

        update_amp_vip_data = database_tasks.UpdateAmphoraeVIPData()
        update_amp_vip_data.execute(_amphorae)

        mock_amphora_repo_update.assert_called_once_with(
            'TEST',
            AMP_ID,
            vrrp_ip=VRRP_IP,
            ha_ip=HA_IP,
            vrrp_port_id=VRRP_PORT_ID,
            ha_port_id=HA_PORT_ID,
            vrrp_id=1)

    def test_update_amphora_vip_data2(self,
                                      mock_generate_uuid,
                                      mock_LOG,
                                      mock_get_session,
                                      mock_loadbalancer_repo_update,
                                      mock_listener_repo_update,
                                      mock_amphora_repo_update,
                                      mock_amphora_repo_delete):
        update_amp_vip_data2 = database_tasks.UpdateAmphoraVIPData()
        update_amp_vip_data2.execute(_amphorae[0])

        mock_amphora_repo_update.assert_called_once_with(
            'TEST',
            AMP_ID,
            vrrp_ip=VRRP_IP,
            ha_ip=HA_IP,
            vrrp_port_id=VRRP_PORT_ID,
            ha_port_id=HA_PORT_ID,
            vrrp_id=1)

    def test_update_amp_failover_details(self,
                                         mock_generate_uuid,
                                         mock_LOG,
                                         mock_get_session,
                                         mock_loadbalancer_repo_update,
                                         mock_listener_repo_update,
                                         mock_amphora_repo_update,
                                         mock_amphora_repo_delete):

        update_amp_fo_details = database_tasks.UpdateAmpFailoverDetails()
        update_amp_fo_details.execute(_amphora_mock, _amphora_mock)

        mock_amphora_repo_update.assert_called_once_with(
            'TEST',
            AMP_ID,
            vrrp_ip=VRRP_IP,
            ha_ip=HA_IP,
            vrrp_port_id=VRRP_PORT_ID,
            ha_port_id=HA_PORT_ID,
            vrrp_id=VRRP_ID)

    @mock.patch('octavia.db.repositories.AmphoraRepository.associate')
    def test_associate_failover_amphora_with_lb_id(
            self,
            mock_associate,
            mock_generate_uuid,
            mock_LOG,
            mock_get_session,
            mock_loadbalancer_repo_update,
            mock_listener_repo_update,
            mock_amphora_repo_update,
            mock_amphora_repo_delete):

        assoc_fo_amp_lb_id = database_tasks.AssociateFailoverAmphoraWithLBID()
        assoc_fo_amp_lb_id.execute(AMP_ID, LB_ID)

        mock_associate.assert_called_once_with('TEST',
                                               load_balancer_id=LB_ID,
                                               amphora_id=AMP_ID)

        # Test revert
        assoc_fo_amp_lb_id.revert(AMP_ID)

        mock_amphora_repo_update.assert_called_once_with('TEST',
                                                         AMP_ID,
                                                         loadbalancer_id=None)

        # Test revert with exception
        mock_amphora_repo_update.reset_mock()
        mock_amphora_repo_update.side_effect = Exception('fail')

        assoc_fo_amp_lb_id.revert(AMP_ID)

        mock_amphora_repo_update.assert_called_once_with('TEST',
                                                         AMP_ID,
                                                         loadbalancer_id=None)

    @mock.patch('octavia.db.repositories.AmphoraRepository.'
                'allocate_and_associate',
                side_effect=[_amphora_mock, None])
    def test_map_loadbalancer_to_amphora(self,
                                         mock_allocate_and_associate,
                                         mock_generate_uuid,
                                         mock_LOG,
                                         mock_get_session,
                                         mock_loadbalancer_repo_update,
                                         mock_listener_repo_update,
                                         mock_amphora_repo_update,
                                         mock_amphora_repo_delete):

        map_lb_to_amp = database_tasks.MapLoadbalancerToAmphora()
        amp_id = map_lb_to_amp.execute(self.loadbalancer_mock.id)

        repo.AmphoraRepository.allocate_and_associate.assert_called_once_with(
            'TEST',
            LB_ID,
            None)

        self.assertEqual(_amphora_mock.id, amp_id)

        amp_id = map_lb_to_amp.execute(self.loadbalancer_mock.id)

        self.assertIsNone(amp_id)

        # Test revert
        map_lb_to_amp.revert(None, self.loadbalancer_mock.id)
        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)

        # Test revert with exception
        repo.LoadBalancerRepository.update.reset_mock()
        mock_loadbalancer_repo_update.side_effect = Exception('fail')
        map_lb_to_amp.revert(None, self.loadbalancer_mock.id)
        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.AmphoraRepository.'
                'allocate_and_associate',
                side_effect=[_amphora_mock, None])
    def test_map_loadbalancer_to_amphora_with_az(self,
                                                 mock_allocate_and_associate,
                                                 mock_generate_uuid,
                                                 mock_LOG,
                                                 mock_get_session,
                                                 mock_loadbalancer_repo_update,
                                                 mock_listener_repo_update,
                                                 mock_amphora_repo_update,
                                                 mock_amphora_repo_delete):

        map_lb_to_amp = database_tasks.MapLoadbalancerToAmphora()
        amp_id = map_lb_to_amp.execute(
            self.loadbalancer_mock.id, availability_zone={
                constants.COMPUTE_ZONE: 'fakeaz'})

        repo.AmphoraRepository.allocate_and_associate.assert_called_once_with(
            'TEST',
            LB_ID,
            'fakeaz')

        self.assertEqual(_amphora_mock.id, amp_id)

        amp_id = map_lb_to_amp.execute(self.loadbalancer_mock.id)

        self.assertIsNone(amp_id)

        # Test revert
        map_lb_to_amp.revert(None, self.loadbalancer_mock.id)
        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)

        # Test revert with exception
        repo.LoadBalancerRepository.update.reset_mock()
        mock_loadbalancer_repo_update.side_effect = Exception('fail')
        map_lb_to_amp.revert(None, self.loadbalancer_mock.id)
        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.AmphoraRepository.get',
                return_value=_amphora_mock)
    @mock.patch('octavia.db.repositories.LoadBalancerRepository.get',
                return_value=_loadbalancer_mock)
    def test_mark_lb_amphorae_deleted_in_db(self,
                                            mock_loadbalancer_repo_get,
                                            mock_amphora_repo_get,
                                            mock_generate_uuid,
                                            mock_LOG,
                                            mock_get_session,
                                            mock_loadbalancer_repo_update,
                                            mock_listener_repo_update,
                                            mock_amphora_repo_update,
                                            mock_amphora_repo_delete):

        mark_amp_deleted_in_db = (database_tasks.
                                  MarkLBAmphoraeDeletedInDB())
        mark_amp_deleted_in_db.execute(_loadbalancer_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            id=AMP_ID,
            status=constants.DELETED)

    @mock.patch('octavia.db.repositories.AmphoraRepository.get',
                return_value=_amphora_mock)
    @mock.patch('octavia.db.repositories.LoadBalancerRepository.get',
                return_value=_loadbalancer_mock)
    def test_mark_amphora_allocated_in_db(self,
                                          mock_loadbalancer_repo_get,
                                          mock_amphora_repo_get,
                                          mock_generate_uuid,
                                          mock_LOG,
                                          mock_get_session,
                                          mock_loadbalancer_repo_update,
                                          mock_listener_repo_update,
                                          mock_amphora_repo_update,
                                          mock_amphora_repo_delete):

        mark_amp_allocated_in_db = (database_tasks.
                                    MarkAmphoraAllocatedInDB())
        mark_amp_allocated_in_db.execute(_amphora_mock,
                                         self.loadbalancer_mock.id)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            AMP_ID,
            status=constants.AMPHORA_ALLOCATED,
            compute_id=COMPUTE_ID,
            lb_network_ip=LB_NET_IP,
            load_balancer_id=LB_ID)

        # Test the revert

        mock_amphora_repo_update.reset_mock()
        mark_amp_allocated_in_db.revert(None, _amphora_mock,
                                        self.loadbalancer_mock.id)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            id=AMP_ID,
            status=constants.ERROR)

        # Test the revert with exception

        mock_amphora_repo_update.reset_mock()
        mock_amphora_repo_update.side_effect = Exception('fail')
        mark_amp_allocated_in_db.revert(None, _amphora_mock,
                                        self.loadbalancer_mock.id)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            id=AMP_ID,
            status=constants.ERROR)

    def test_mark_amphora_booting_in_db(self,
                                        mock_generate_uuid,
                                        mock_LOG,
                                        mock_get_session,
                                        mock_loadbalancer_repo_update,
                                        mock_listener_repo_update,
                                        mock_amphora_repo_update,
                                        mock_amphora_repo_delete):

        mark_amp_booting_in_db = database_tasks.MarkAmphoraBootingInDB()
        mark_amp_booting_in_db.execute(_amphora_mock.id,
                                       _amphora_mock.compute_id)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            AMP_ID,
            status=constants.AMPHORA_BOOTING,
            compute_id=COMPUTE_ID)

        # Test the revert

        mock_amphora_repo_update.reset_mock()
        mark_amp_booting_in_db.revert(None, _amphora_mock.id,
                                      _amphora_mock.compute_id)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            AMP_ID,
            status=constants.ERROR,
            compute_id=COMPUTE_ID)

        # Test the revert with exception

        mock_amphora_repo_update.reset_mock()
        mock_amphora_repo_update.side_effect = Exception('fail')
        mark_amp_booting_in_db.revert(None, _amphora_mock.id,
                                      _amphora_mock.compute_id)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            AMP_ID,
            status=constants.ERROR,
            compute_id=COMPUTE_ID)

    def test_mark_amphora_deleted_in_db(self,
                                        mock_generate_uuid,
                                        mock_LOG,
                                        mock_get_session,
                                        mock_loadbalancer_repo_update,
                                        mock_listener_repo_update,
                                        mock_amphora_repo_update,
                                        mock_amphora_repo_delete):

        mark_amp_deleted_in_db = database_tasks.MarkAmphoraDeletedInDB()
        mark_amp_deleted_in_db.execute(_amphora_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            AMP_ID,
            status=constants.DELETED)

        # Test the revert
        mock_amphora_repo_update.reset_mock()
        mark_amp_deleted_in_db.revert(_amphora_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            id=AMP_ID,
            status=constants.ERROR)

        # Test the revert with exception
        mock_amphora_repo_update.reset_mock()
        mock_amphora_repo_update.side_effect = Exception('fail')
        mark_amp_deleted_in_db.revert(_amphora_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            id=AMP_ID,
            status=constants.ERROR)

    def test_mark_amphora_pending_delete_in_db(self,
                                               mock_generate_uuid,
                                               mock_LOG,
                                               mock_get_session,
                                               mock_loadbalancer_repo_update,
                                               mock_listener_repo_update,
                                               mock_amphora_repo_update,
                                               mock_amphora_repo_delete):

        mark_amp_pending_delete_in_db = (database_tasks.
                                         MarkAmphoraPendingDeleteInDB())
        mark_amp_pending_delete_in_db.execute(_amphora_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            AMP_ID,
            status=constants.PENDING_DELETE)

        # Test the revert
        mock_amphora_repo_update.reset_mock()
        mark_amp_pending_delete_in_db.revert(_amphora_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            id=AMP_ID,
            status=constants.ERROR)

        # Test the revert with exception
        mock_amphora_repo_update.reset_mock()
        mock_amphora_repo_update.side_effect = Exception('fail')

        mark_amp_pending_delete_in_db.revert(_amphora_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            id=AMP_ID,
            status=constants.ERROR)

    def test_mark_amphora_pending_update_in_db(self,
                                               mock_generate_uuid,
                                               mock_LOG,
                                               mock_get_session,
                                               mock_loadbalancer_repo_update,
                                               mock_listener_repo_update,
                                               mock_amphora_repo_update,
                                               mock_amphora_repo_delete):

        mark_amp_pending_update_in_db = (database_tasks.
                                         MarkAmphoraPendingUpdateInDB())
        mark_amp_pending_update_in_db.execute(_amphora_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            AMP_ID,
            status=constants.PENDING_UPDATE)

        # Test the revert
        mock_amphora_repo_update.reset_mock()
        mark_amp_pending_update_in_db.revert(_amphora_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            id=AMP_ID,
            status=constants.ERROR)

        # Test the revert with exception
        mock_amphora_repo_update.reset_mock()
        mock_amphora_repo_update.side_effect = Exception('fail')
        mark_amp_pending_update_in_db.revert(_amphora_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            id=AMP_ID,
            status=constants.ERROR)

    def test_mark_amphora_ready_in_db(self,
                                      mock_generate_uuid,
                                      mock_LOG,
                                      mock_get_session,
                                      mock_loadbalancer_repo_update,
                                      mock_listener_repo_update,
                                      mock_amphora_repo_update,
                                      mock_amphora_repo_delete):

        _amphora_mock.lb_network_ip = LB_NET_IP

        mark_amp_ready_in_db = database_tasks.MarkAmphoraReadyInDB()
        mark_amp_ready_in_db.execute(_amphora_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            AMP_ID,
            status=constants.AMPHORA_READY,
            compute_id=COMPUTE_ID,
            lb_network_ip=LB_NET_IP)

        # Test the revert

        mock_amphora_repo_update.reset_mock()
        mark_amp_ready_in_db.revert(_amphora_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            AMP_ID,
            status=constants.ERROR,
            compute_id=COMPUTE_ID,
            lb_network_ip=LB_NET_IP)

        # Test the revert with exception

        mock_amphora_repo_update.reset_mock()
        mock_amphora_repo_update.side_effect = Exception('fail')
        mark_amp_ready_in_db.revert(_amphora_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            AMP_ID,
            status=constants.ERROR,
            compute_id=COMPUTE_ID,
            lb_network_ip=LB_NET_IP)

    @mock.patch('octavia.db.repositories.AmphoraRepository.get')
    def test_update_amphora_info(self,
                                 mock_amphora_repo_get,
                                 mock_generate_uuid,
                                 mock_LOG,
                                 mock_get_session,
                                 mock_loadbalancer_repo_update,
                                 mock_listener_repo_update,
                                 mock_amphora_repo_update,
                                 mock_amphora_repo_delete):

        update_amphora_info = database_tasks.UpdateAmphoraInfo()
        update_amphora_info.execute(AMP_ID, _compute_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            AMP_ID,
            lb_network_ip=LB_NET_IP,
            cached_zone=CACHED_ZONE,
            image_id=IMAGE_ID,
            compute_flavor=COMPUTE_FLAVOR)

        repo.AmphoraRepository.get.assert_called_once_with(
            'TEST',
            id=AMP_ID)

    def test_mark_listener_deleted_in_db(self,
                                         mock_generate_uuid,
                                         mock_LOG,
                                         mock_get_session,
                                         mock_loadbalancer_repo_update,
                                         mock_listener_repo_update,
                                         mock_amphora_repo_update,
                                         mock_amphora_repo_delete):

        mark_listener_deleted = database_tasks.MarkListenerDeletedInDB()
        mark_listener_deleted.execute(self.listener_mock)

        repo.ListenerRepository.update.assert_called_once_with(
            'TEST',
            LISTENER_ID,
            provisioning_status=constants.DELETED)

        # Test the revert
        mock_listener_repo_update.reset_mock()
        mark_listener_deleted.revert(self.listener_mock)

        repo.ListenerRepository.update.assert_called_once_with(
            'TEST',
            id=LISTENER_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_listener_repo_update.reset_mock()
        mock_listener_repo_update.side_effect = Exception('fail')
        mark_listener_deleted.revert(self.listener_mock)

        repo.ListenerRepository.update.assert_called_once_with(
            'TEST',
            id=LISTENER_ID,
            provisioning_status=constants.ERROR)

    def test_mark_listener_pending_deleted_in_db(self,
                                                 mock_generate_uuid,
                                                 mock_LOG,
                                                 mock_get_session,
                                                 mock_loadbalancer_repo_update,
                                                 mock_listener_repo_update,
                                                 mock_amphora_repo_update,
                                                 mock_amphora_repo_delete):

        mark_listener_pending_delete = (database_tasks.
                                        MarkListenerPendingDeleteInDB())
        mark_listener_pending_delete.execute(self.listener_mock)

        repo.ListenerRepository.update.assert_called_once_with(
            'TEST',
            LISTENER_ID,
            provisioning_status=constants.PENDING_DELETE)

        # Test the revert
        mock_listener_repo_update.reset_mock()
        mark_listener_pending_delete.revert(self.listener_mock)

        repo.ListenerRepository.update.assert_called_once_with(
            'TEST',
            id=LISTENER_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_listener_repo_update.reset_mock()
        mock_listener_repo_update.side_effect = Exception('fail')
        mark_listener_pending_delete.revert(self.listener_mock)

        repo.ListenerRepository.update.assert_called_once_with(
            'TEST',
            id=LISTENER_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.ListenerRepository.'
                'prov_status_active_if_not_error')
    def test_mark_lb_and_listeners_active_in_db(self,
                                                mock_list_not_error,
                                                mock_generate_uuid,
                                                mock_LOG,
                                                mock_get_session,
                                                mock_loadbalancer_repo_update,
                                                mock_listener_repo_update,
                                                mock_amphora_repo_update,
                                                mock_amphora_repo_delete):

        listener_dict = {constants.LISTENER_ID: LISTENER_ID,
                         constants.LOADBALANCER_ID: LB_ID}
        mark_lb_and_listeners_active = (database_tasks.
                                        MarkLBAndListenersActiveInDB())
        mark_lb_and_listeners_active.execute(LB_ID, [listener_dict])

        mock_list_not_error.assert_called_once_with('TEST', LISTENER_ID)
        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            LB_ID,
            provisioning_status=constants.ACTIVE)

        # Test with LB_ID from listeners
        mock_loadbalancer_repo_update.reset_mock()
        mock_list_not_error.reset_mock()

        listener_dict = {constants.LISTENER_ID: LISTENER_ID,
                         constants.LOADBALANCER_ID: LB_ID}
        mark_lb_and_listeners_active = (database_tasks.
                                        MarkLBAndListenersActiveInDB())
        mark_lb_and_listeners_active.execute(None, [listener_dict])

        mock_list_not_error.assert_called_once_with('TEST', LISTENER_ID)
        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            LB_ID,
            provisioning_status=constants.ACTIVE)

        # Test with no LB_ID
        mock_loadbalancer_repo_update.reset_mock()
        mark_lb_and_listeners_active.execute(None, [])
        mock_loadbalancer_repo_update.assert_not_called()

        # Test the revert
        mock_loadbalancer_repo_update.reset_mock()
        mock_listener_repo_update.reset_mock()

        mark_lb_and_listeners_active.revert(LB_ID, [listener_dict])

        repo.ListenerRepository.update.assert_called_once_with(
            'TEST',
            id=LISTENER_ID,
            provisioning_status=constants.ERROR)
        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)

        # Test the revert LB_ID from listeners
        mock_loadbalancer_repo_update.reset_mock()
        mock_listener_repo_update.reset_mock()

        mark_lb_and_listeners_active.revert(None, [listener_dict])

        repo.ListenerRepository.update.assert_called_once_with(
            'TEST',
            id=LISTENER_ID,
            provisioning_status=constants.ERROR)
        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)

        # Test the revert no LB_ID
        mock_loadbalancer_repo_update.reset_mock()
        mock_listener_repo_update.reset_mock()

        mark_lb_and_listeners_active.revert(None, [])

        mock_loadbalancer_repo_update.assert_not_called()
        mock_listener_repo_update.assert_not_called()

        # Test the revert with exceptions
        mock_loadbalancer_repo_update.reset_mock()
        mock_loadbalancer_repo_update.side_effect = Exception('fail')
        mock_listener_repo_update.reset_mock()
        mock_listener_repo_update.side_effect = Exception('fail')

        mark_lb_and_listeners_active.revert(LB_ID, [listener_dict])

        repo.ListenerRepository.update.assert_called_once_with(
            'TEST',
            id=LISTENER_ID,
            provisioning_status=constants.ERROR)
        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.common.tls_utils.cert_parser.get_cert_expiration',
                return_value=_cert_mock)
    def test_update_amphora_db_cert_exp(self,
                                        mock_generate_uuid,
                                        mock_LOG,
                                        mock_get_session,
                                        mock_loadbalancer_repo_update,
                                        mock_listener_repo_update,
                                        mock_amphora_repo_update,
                                        mock_amphora_repo_delete,
                                        mock_get_cert_exp):

        update_amp_cert = database_tasks.UpdateAmphoraDBCertExpiration()
        key = utils.get_six_compatible_server_certs_key_passphrase()
        fer = fernet.Fernet(key)
        _pem_mock = fer.encrypt(
            utils.get_six_compatible_value('test_cert')
        )
        update_amp_cert.execute(_amphora_mock.id, _pem_mock)

        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            AMP_ID,
            cert_expiration=_cert_mock)

    def test_update_amphora_cert_busy_to_false(self,
                                               mock_generate_uuid,
                                               mock_LOG,
                                               mock_get_session,
                                               mock_loadbalancer_repo_update,
                                               mock_listener_repo_update,
                                               mock_amphora_repo_update,
                                               mock_amphora_repo_delete):
        amp_cert_busy_to_F = database_tasks.UpdateAmphoraCertBusyToFalse()
        amp_cert_busy_to_F.execute(_amphora_mock)
        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST',
            AMP_ID,
            cert_busy=False)

    def test_mark_LB_active_in_db(self,
                                  mock_generate_uuid,
                                  mock_LOG,
                                  mock_get_session,
                                  mock_loadbalancer_repo_update,
                                  mock_listener_repo_update,
                                  mock_amphora_repo_update,
                                  mock_amphora_repo_delete):

        mark_loadbalancer_active = database_tasks.MarkLBActiveInDB()
        mark_loadbalancer_active.execute(self.loadbalancer_mock)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            LB_ID,
            provisioning_status=constants.ACTIVE)
        self.assertEqual(0, repo.ListenerRepository.update.call_count)

        # Test the revert
        mock_loadbalancer_repo_update.reset_mock()
        mark_loadbalancer_active.revert(self.loadbalancer_mock)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)
        self.assertEqual(0, repo.ListenerRepository.update.call_count)

        # Test the revert with exception
        mock_loadbalancer_repo_update.reset_mock()
        mock_loadbalancer_repo_update.side_effect = Exception('fail')
        mark_loadbalancer_active.revert(self.loadbalancer_mock)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)
        self.assertEqual(0, repo.ListenerRepository.update.call_count)

    def test_mark_LB_active_in_db_by_listener(self,
                                              mock_generate_uuid,
                                              mock_LOG,
                                              mock_get_session,
                                              mock_loadbalancer_repo_update,
                                              mock_listener_repo_update,
                                              mock_amphora_repo_update,
                                              mock_amphora_repo_delete):

        listener_dict = {'loadbalancer_id': LB_ID}
        mark_loadbalancer_active = database_tasks.MarkLBActiveInDBByListener()
        mark_loadbalancer_active.execute(listener_dict)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            LB_ID,
            provisioning_status=constants.ACTIVE)
        self.assertEqual(0, repo.ListenerRepository.update.call_count)

        # Test the revert
        mock_loadbalancer_repo_update.reset_mock()
        mark_loadbalancer_active.revert(listener_dict)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)
        self.assertEqual(0, repo.ListenerRepository.update.call_count)

        # Test the revert with exception
        mock_loadbalancer_repo_update.reset_mock()
        mock_loadbalancer_repo_update.side_effect = Exception('fail')
        mark_loadbalancer_active.revert(listener_dict)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)
        self.assertEqual(0, repo.ListenerRepository.update.call_count)

    def test_mark_LB_active_in_db_and_listeners(self,
                                                mock_generate_uuid,
                                                mock_LOG,
                                                mock_get_session,
                                                mock_loadbalancer_repo_update,
                                                mock_listener_repo_update,
                                                mock_amphora_repo_update,
                                                mock_amphora_repo_delete):
        listeners = [data_models.Listener(id='listener1'),
                     data_models.Listener(id='listener2')]
        lb = data_models.LoadBalancer(id=LB_ID, listeners=listeners)
        mark_lb_active = database_tasks.MarkLBActiveInDB(mark_subobjects=True)
        mark_lb_active.execute(lb)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            lb.id,
            provisioning_status=constants.ACTIVE)
        self.assertEqual(2, repo.ListenerRepository.update.call_count)
        repo.ListenerRepository.update.has_calls(
            [mock.call('TEST', listeners[0].id,
                       provisioning_status=constants.ACTIVE),
             mock.call('TEST', listeners[1].id,
                       provisioning_status=constants.ACTIVE)])

        mock_loadbalancer_repo_update.reset_mock()
        mock_listener_repo_update.reset_mock()
        mark_lb_active.revert(lb)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=lb.id,
            provisioning_status=constants.ERROR)
        self.assertEqual(2, repo.ListenerRepository.update.call_count)
        repo.ListenerRepository.update.has_calls(
            [mock.call('TEST', listeners[0].id,
                       provisioning_status=constants.ERROR),
             mock.call('TEST', listeners[1].id,
                       provisioning_status=constants.ERROR)])

    @mock.patch('octavia.db.repositories.PoolRepository.update')
    @mock.patch('octavia.db.repositories.MemberRepository.update')
    @mock.patch('octavia.db.repositories.HealthMonitorRepository.update')
    @mock.patch('octavia.db.repositories.L7PolicyRepository.update')
    @mock.patch('octavia.db.repositories.L7RuleRepository.update')
    def test_mark_LB_active_in_db_full_graph(self,
                                             mock_l7r_repo_update,
                                             mock_l7p_repo_update,
                                             mock_hm_repo_update,
                                             mock_member_repo_update,
                                             mock_pool_repo_update,
                                             mock_generate_uuid,
                                             mock_LOG,
                                             mock_get_session,
                                             mock_loadbalancer_repo_update,
                                             mock_listener_repo_update,
                                             mock_amphora_repo_update,
                                             mock_amphora_repo_delete):
        unused_pool = data_models.Pool(id='unused_pool')
        members1 = [{constants.MEMBER_ID: 'member1'},
                    {constants.MEMBER_ID: 'member2'}]
        health_monitor = data_models.HealthMonitor(id='hm1')
        default_pool = data_models.Pool(id='default_pool',
                                        members=members1,
                                        health_monitor=health_monitor)
        listener1 = data_models.Listener(id='listener1',
                                         default_pool=default_pool)
        members2 = [{constants.MEMBER_ID: 'member3'},
                    {constants.MEMBER_ID: 'member4'}]
        redirect_pool = data_models.Pool(id='redirect_pool',
                                         members=members2)
        l7rules = [data_models.L7Rule(id='rule1')]
        redirect_policy = data_models.L7Policy(id='redirect_policy',
                                               redirect_pool=redirect_pool,
                                               l7rules=l7rules)
        l7policies = [redirect_policy]
        listener2 = data_models.Listener(id='listener2',
                                         l7policies=l7policies)
        listener2.l7policies = l7policies
        listeners = [listener1, listener2]
        pools = [default_pool, redirect_pool, unused_pool]

        lb = data_models.LoadBalancer(id=LB_ID, listeners=listeners,
                                      pools=pools)
        mark_lb_active = database_tasks.MarkLBActiveInDB(mark_subobjects=True)
        mark_lb_active.execute(lb)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            lb.id,
            provisioning_status=constants.ACTIVE)
        self.assertEqual(2, repo.ListenerRepository.update.call_count)
        repo.ListenerRepository.update.has_calls(
            [mock.call('TEST', listeners[0].id,
                       provisioning_status=constants.ACTIVE),
             mock.call('TEST', listeners[1].id,
                       provisioning_status=constants.ACTIVE)])
        self.assertEqual(2, repo.PoolRepository.update.call_count)
        repo.PoolRepository.update.has_calls(
            [mock.call('TEST', default_pool.id,
                       provisioning_status=constants.ACTIVE),
             mock.call('TEST', redirect_pool.id,
                       provisioning_status=constants.ACTIVE)])
        self.assertEqual(1, repo.HealthMonitorRepository.update.call_count)
        repo.HealthMonitorRepository.update.has_calls(
            [mock.call('TEST', health_monitor.id,
                       provisioning_status=constants.ACTIVE)])
        self.assertEqual(1, repo.L7PolicyRepository.update.call_count)
        repo.L7PolicyRepository.update.has_calls(
            [mock.call('TEST', l7policies[0].id,
                       provisioning_status=constants.ACTIVE)])
        self.assertEqual(1, repo.L7RuleRepository.update.call_count)
        repo.L7RuleRepository.update.has_calls(
            [mock.call('TEST', l7rules[0].id,
                       provisioning_status=constants.ACTIVE)])

        mock_loadbalancer_repo_update.reset_mock()
        mock_listener_repo_update.reset_mock()
        mock_pool_repo_update.reset_mock()
        mock_member_repo_update.reset_mock()
        mock_hm_repo_update.reset_mock()
        mock_l7p_repo_update.reset_mock()
        mock_l7r_repo_update.reset_mock()
        mark_lb_active.revert(lb)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=lb.id,
            provisioning_status=constants.ERROR)
        self.assertEqual(2, repo.ListenerRepository.update.call_count)
        repo.ListenerRepository.update.has_calls(
            [mock.call('TEST', listeners[0].id,
                       provisioning_status=constants.ERROR),
             mock.call('TEST', listeners[1].id,
                       provisioning_status=constants.ERROR)])
        self.assertEqual(2, repo.PoolRepository.update.call_count)
        repo.PoolRepository.update.has_calls(
            [mock.call('TEST', default_pool.id,
                       provisioning_status=constants.ERROR),
             mock.call('TEST', redirect_pool.id,
                       provisioning_status=constants.ERROR)])
        self.assertEqual(1, repo.HealthMonitorRepository.update.call_count)
        repo.HealthMonitorRepository.update.has_calls(
            [mock.call('TEST', health_monitor.id,
                       provisioning_status=constants.ERROR)])
        self.assertEqual(1, repo.L7PolicyRepository.update.call_count)
        repo.L7PolicyRepository.update.has_calls(
            [mock.call('TEST', l7policies[0].id,
                       provisioning_status=constants.ERROR)])
        self.assertEqual(1, repo.L7RuleRepository.update.call_count)
        repo.L7RuleRepository.update.has_calls(
            [mock.call('TEST', l7rules[0].id,
                       provisioning_status=constants.ERROR)])

    def test_mark_LB_deleted_in_db(self,
                                   mock_generate_uuid,
                                   mock_LOG,
                                   mock_get_session,
                                   mock_loadbalancer_repo_update,
                                   mock_listener_repo_update,
                                   mock_amphora_repo_update,
                                   mock_amphora_repo_delete):

        mark_loadbalancer_deleted = database_tasks.MarkLBDeletedInDB()
        mark_loadbalancer_deleted.execute(self.loadbalancer_mock)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            LB_ID,
            provisioning_status=constants.DELETED)

        # Test the revert
        mock_loadbalancer_repo_update.reset_mock()
        mark_loadbalancer_deleted.revert(self.loadbalancer_mock)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_loadbalancer_repo_update.reset_mock()
        mock_loadbalancer_repo_update.side_effect = Exception('fail')
        mark_loadbalancer_deleted.revert(self.loadbalancer_mock)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)

    def test_mark_LB_pending_deleted_in_db(self,
                                           mock_generate_uuid,
                                           mock_LOG,
                                           mock_get_session,
                                           mock_loadbalancer_repo_update,
                                           mock_listener_repo_update,
                                           mock_amphora_repo_update,
                                           mock_amphora_repo_delete):

        mark_loadbalancer_pending_delete = (database_tasks.
                                            MarkLBPendingDeleteInDB())
        mark_loadbalancer_pending_delete.execute(self.loadbalancer_mock)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            LB_ID,
            provisioning_status=constants.PENDING_DELETE)

        # Test the revert
        mock_loadbalancer_repo_update.reset_mock()
        mark_loadbalancer_pending_delete.revert(self.loadbalancer_mock)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_loadbalancer_repo_update.reset_mock()
        mock_loadbalancer_repo_update.side_effect = Exception('fail')
        mark_loadbalancer_pending_delete.revert(self.loadbalancer_mock)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.HealthMonitorRepository.update')
    def test_update_health_monitor_in_db(self,
                                         mock_health_mon_repo_update,
                                         mock_generate_uuid,
                                         mock_LOG,
                                         mock_get_session,
                                         mock_loadbalancer_repo_update,
                                         mock_listener_repo_update,
                                         mock_amphora_repo_update,
                                         mock_amphora_repo_delete):

        update_health_mon = database_tasks.UpdateHealthMonInDB()
        update_health_mon.execute(self.health_mon_mock,
                                  {'delay': 1, 'timeout': 2})

        repo.HealthMonitorRepository.update.assert_called_once_with(
            'TEST',
            HM_ID,
            delay=1, timeout=2)

        # Test the revert
        mock_health_mon_repo_update.reset_mock()
        update_health_mon.revert(self.health_mon_mock)

        repo.HealthMonitorRepository.update.assert_called_once_with(
            'TEST',
            HM_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_health_mon_repo_update.reset_mock()
        mock_health_mon_repo_update.side_effect = Exception('fail')
        update_health_mon.revert(self.health_mon_mock)

        repo.HealthMonitorRepository.update.assert_called_once_with(
            'TEST',
            HM_ID,
            provisioning_status=constants.ERROR)

    def test_update_load_balancer_in_db(self,
                                        mock_generate_uuid,
                                        mock_LOG,
                                        mock_get_session,
                                        mock_loadbalancer_repo_update,
                                        mock_listener_repo_update,
                                        mock_amphora_repo_update,
                                        mock_amphora_repo_delete):

        update_load_balancer = database_tasks.UpdateLoadbalancerInDB()
        update_load_balancer.execute(self.loadbalancer_mock,
                                     {'name': 'test', 'description': 'test2'})

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            LB_ID,
            name='test', description='test2')

        # Test the revert
        mock_loadbalancer_repo_update.reset_mock()
        update_load_balancer.revert(self.loadbalancer_mock)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_loadbalancer_repo_update.reset_mock()
        mock_loadbalancer_repo_update.side_effect = Exception('fail')
        update_load_balancer.revert(self.loadbalancer_mock)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.VipRepository.update')
    def test_update_vip_in_db_during_update_loadbalancer(self,
                                                         mock_vip_update,
                                                         mock_generate_uuid,
                                                         mock_LOG,
                                                         mock_get_session,
                                                         mock_lb_update,
                                                         mock_listener_update,
                                                         mock_amphora_update,
                                                         mock_amphora_delete):

        self.loadbalancer_mock.vip.load_balancer_id = LB_ID
        update_load_balancer = database_tasks.UpdateLoadbalancerInDB()
        update_load_balancer.execute(self.loadbalancer_mock,
                                     {'name': 'test',
                                      'description': 'test2',
                                      'vip': {'qos_policy_id': 'fool'}})

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            LB_ID,
            name='test', description='test2')

        repo.VipRepository.update.assert_called_once_with('TEST', LB_ID,
                                                          qos_policy_id='fool')

    def test_update_listener_in_db(self,
                                   mock_generate_uuid,
                                   mock_LOG,
                                   mock_get_session,
                                   mock_loadbalancer_repo_update,
                                   mock_listener_repo_update,
                                   mock_amphora_repo_update,
                                   mock_amphora_repo_delete):

        update_listener = database_tasks.UpdateListenerInDB()
        listener_dict = {constants.LISTENER_ID: LISTENER_ID}
        update_listener.execute(listener_dict,
                                {'name': 'test', 'description': 'test2'})

        repo.ListenerRepository.update.assert_called_once_with(
            'TEST',
            LISTENER_ID,
            name='test', description='test2')

        # Test the revert
        mock_listener_repo_update.reset_mock()
        update_listener.revert(listener_dict)
        repo.ListenerRepository.update.assert_called_once_with(
            'TEST',
            id=LISTENER_ID,
            provisioning_status=constants.ERROR)

        # Test the revert
        mock_listener_repo_update.reset_mock()
        mock_listener_repo_update.side_effect = Exception('fail')
        update_listener.revert(listener_dict)
        repo.ListenerRepository.update.assert_called_once_with(
            'TEST',
            id=LISTENER_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.MemberRepository.update')
    def test_update_member_in_db(self,
                                 mock_member_repo_update,
                                 mock_generate_uuid,
                                 mock_LOG,
                                 mock_get_session,
                                 mock_loadbalancer_repo_update,
                                 mock_listener_repo_update,
                                 mock_amphora_repo_update,
                                 mock_amphora_repo_delete):

        update_member = database_tasks.UpdateMemberInDB()
        update_member.execute(self.member_mock,
                              {'weight': 1, 'ip_address': '10.1.0.0'})

        repo.MemberRepository.update.assert_called_once_with(
            'TEST',
            MEMBER_ID,
            weight=1, ip_address='10.1.0.0')

        # Test the revert
        mock_member_repo_update.reset_mock()
        update_member.revert(self.member_mock)

        repo.MemberRepository.update.assert_called_once_with(
            'TEST',
            MEMBER_ID,
            provisioning_status=constants.ERROR)

        # Test the revert
        mock_member_repo_update.reset_mock()
        mock_member_repo_update.side_effect = Exception('fail')
        update_member.revert(self.member_mock)

        repo.MemberRepository.update.assert_called_once_with(
            'TEST',
            MEMBER_ID,
            provisioning_status=constants.ERROR)

    @mock.patch(
        'octavia.db.repositories.Repositories.update_pool_and_sp')
    def test_update_pool_in_db(self,
                               mock_repos_pool_update,
                               mock_generate_uuid,
                               mock_LOG,
                               mock_get_session,
                               mock_loadbalancer_repo_update,
                               mock_listener_repo_update,
                               mock_amphora_repo_update,
                               mock_amphora_repo_delete):

        sp_dict = {'type': 'SOURCE_IP', 'cookie_name': None}
        update_dict = {'name': 'test', 'description': 'test2',
                       'session_persistence': sp_dict}
        update_pool = database_tasks.UpdatePoolInDB()
        update_pool.execute(POOL_ID,
                            update_dict)

        repo.Repositories.update_pool_and_sp.assert_called_once_with(
            'TEST',
            POOL_ID,
            update_dict)

        # Test the revert
        mock_repos_pool_update.reset_mock()
        update_pool.revert(POOL_ID)

        repo.Repositories.update_pool_and_sp.assert_called_once_with(
            'TEST',
            POOL_ID,
            {'provisioning_status': constants.ERROR})

        # Test the revert with exception
        mock_repos_pool_update.reset_mock()
        mock_repos_pool_update.side_effect = Exception('fail')
        update_pool.revert(POOL_ID)

        repo.Repositories.update_pool_and_sp.assert_called_once_with(
            'TEST',
            POOL_ID,
            {'provisioning_status': constants.ERROR})

    @mock.patch('octavia.db.repositories.L7PolicyRepository.update')
    def test_update_l7policy_in_db(self,
                                   mock_l7policy_repo_update,
                                   mock_generate_uuid,
                                   mock_LOG,
                                   mock_get_session,
                                   mock_loadbalancer_repo_update,
                                   mock_listener_repo_update,
                                   mock_amphora_repo_update,
                                   mock_amphora_repo_delete):

        update_l7policy = database_tasks.UpdateL7PolicyInDB()
        update_l7policy.execute(self.l7policy_mock,
                                {'action': constants.L7POLICY_ACTION_REJECT})

        repo.L7PolicyRepository.update.assert_called_once_with(
            'TEST',
            L7POLICY_ID,
            action=constants.L7POLICY_ACTION_REJECT)

        # Test the revert
        mock_l7policy_repo_update.reset_mock()
        update_l7policy.revert(self.l7policy_mock)

        repo.L7PolicyRepository.update.assert_called_once_with(
            'TEST',
            L7POLICY_ID,
            provisioning_status=constants.ERROR)

        # Test the revert
        mock_l7policy_repo_update.reset_mock()
        mock_l7policy_repo_update.side_effect = Exception('fail')
        update_l7policy.revert(self.l7policy_mock)

        repo.L7PolicyRepository.update.assert_called_once_with(
            'TEST',
            L7POLICY_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.L7RuleRepository.update')
    @mock.patch('octavia.db.repositories.L7PolicyRepository.update')
    def test_update_l7rule_in_db(self,
                                 mock_l7rule_repo_update,
                                 mock_l7policy_repo_update,
                                 mock_generate_uuid,
                                 mock_LOG,
                                 mock_get_session,
                                 mock_loadbalancer_repo_update,
                                 mock_listener_repo_update,
                                 mock_amphora_repo_update,
                                 mock_amphora_repo_delete):

        update_l7rule = database_tasks.UpdateL7RuleInDB()
        update_l7rule.execute(
            self.l7rule_mock,
            {'type': constants.L7RULE_TYPE_PATH,
             'compare_type': constants.L7RULE_COMPARE_TYPE_STARTS_WITH,
             'value': '/api'})

        repo.L7RuleRepository.update.assert_called_once_with(
            'TEST',
            L7RULE_ID,
            type=constants.L7RULE_TYPE_PATH,
            compare_type=constants.L7RULE_COMPARE_TYPE_STARTS_WITH,
            value='/api')

        # Test the revert
        mock_l7rule_repo_update.reset_mock()
        update_l7rule.revert(self.l7rule_mock)

        repo.L7PolicyRepository.update.assert_called_once_with(
            'TEST',
            L7POLICY_ID,
            provisioning_status=constants.ERROR)

        # Test the revert
        mock_l7rule_repo_update.reset_mock()
        mock_l7rule_repo_update.side_effect = Exception('fail')
        update_l7rule.revert(self.l7rule_mock)

        repo.L7PolicyRepository.update.assert_called_once_with(
            'TEST',
            L7POLICY_ID,
            provisioning_status=constants.ERROR)

    def test_get_amphora_details(self,
                                 mock_generate_uuid,
                                 mock_LOG,
                                 mock_get_session,
                                 mock_loadbalancer_repo_update,
                                 mock_listener_repo_update,
                                 mock_amphora_repo_update,
                                 mock_amphora_repo_delete):

        get_amp_details = database_tasks.GetAmphoraDetails()
        new_amp = get_amp_details.execute(_amphora_mock)

        self.assertEqual(AMP_ID, new_amp.id)
        self.assertEqual(VRRP_IP, new_amp.vrrp_ip)
        self.assertEqual(HA_IP, new_amp.ha_ip)
        self.assertEqual(VRRP_PORT_ID, new_amp.vrrp_port_id)
        self.assertEqual(AMP_ROLE, new_amp.role)
        self.assertEqual(VRRP_ID, new_amp.vrrp_id)
        self.assertEqual(VRRP_PRIORITY, new_amp.vrrp_priority)

    def test_mark_amphora_role_indb(self,
                                    mock_generate_uuid,
                                    mock_LOG,
                                    mock_get_session,
                                    mock_loadbalancer_repo_update,
                                    mock_listener_repo_update,
                                    mock_amphora_repo_update,
                                    mock_amphora_repo_delete):

        mark_amp_master_indb = database_tasks.MarkAmphoraMasterInDB()
        mark_amp_master_indb.execute(_amphora_mock)
        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST', AMP_ID, role='MASTER',
            vrrp_priority=constants.ROLE_MASTER_PRIORITY)

        mock_amphora_repo_update.reset_mock()

        mark_amp_master_indb.revert("BADRESULT", _amphora_mock)
        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST', AMP_ID, role=None, vrrp_priority=None)

        mock_amphora_repo_update.reset_mock()

        failure_obj = failure.Failure.from_exception(Exception("TESTEXCEPT"))
        mark_amp_master_indb.revert(failure_obj, _amphora_mock)
        self.assertFalse(repo.AmphoraRepository.update.called)

        mock_amphora_repo_update.reset_mock()

        mark_amp_backup_indb = database_tasks.MarkAmphoraBackupInDB()
        mark_amp_backup_indb.execute(_amphora_mock)
        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST', AMP_ID, role='BACKUP',
            vrrp_priority=constants.ROLE_BACKUP_PRIORITY)

        mock_amphora_repo_update.reset_mock()

        mark_amp_backup_indb.revert("BADRESULT", _amphora_mock)
        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST', AMP_ID, role=None, vrrp_priority=None)

        mock_amphora_repo_update.reset_mock()

        mark_amp_standalone_indb = database_tasks.MarkAmphoraStandAloneInDB()
        mark_amp_standalone_indb.execute(_amphora_mock)
        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST', AMP_ID, role='STANDALONE',
            vrrp_priority=None)

        mock_amphora_repo_update.reset_mock()

        mark_amp_standalone_indb.revert("BADRESULT", _amphora_mock)
        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST', AMP_ID, role=None, vrrp_priority=None)

        # Test revert with exception
        mock_amphora_repo_update.reset_mock()
        mock_amphora_repo_update.side_effect = Exception('fail')
        mark_amp_standalone_indb.revert("BADRESULT", _amphora_mock)
        repo.AmphoraRepository.update.assert_called_once_with(
            'TEST', AMP_ID, role=None, vrrp_priority=None)

    @mock.patch('octavia.db.repositories.AmphoraRepository.get')
    def test_get_amphorae_from_loadbalancer(self,
                                            mock_amphora_get,
                                            mock_generate_uuid,
                                            mock_LOG,
                                            mock_get_session,
                                            mock_loadbalancer_repo_update,
                                            mock_listener_repo_update,
                                            mock_amphora_repo_update,
                                            mock_amphora_repo_delete):
        amp1 = mock.MagicMock()
        amp1.id = uuidutils.generate_uuid()
        amp2 = mock.MagicMock()
        amp2.id = uuidutils.generate_uuid()
        lb = mock.MagicMock()
        lb.amphorae = [amp1, amp2]

        mock_amphora_get.side_effect = [_amphora_mock, None]

        get_amps_from_lb_obj = database_tasks.GetAmphoraeFromLoadbalancer()
        result = get_amps_from_lb_obj.execute(lb)
        self.assertEqual([_amphora_mock], result)

    @mock.patch('octavia.db.repositories.ListenerRepository.get')
    def test_get_listeners_from_loadbalancer(self,
                                             mock_listener_get,
                                             mock_generate_uuid,
                                             mock_LOG,
                                             mock_get_session,
                                             mock_loadbalancer_repo_update,
                                             mock_listener_repo_update,
                                             mock_amphora_repo_update,
                                             mock_amphora_repo_delete):
        mock_listener_get.return_value = _listener_mock
        _loadbalancer_mock.listeners = [_listener_mock]
        get_list_from_lb_obj = database_tasks.GetListenersFromLoadbalancer()
        result = get_list_from_lb_obj.execute(_loadbalancer_mock)
        mock_listener_get.assert_called_once_with('TEST', id=_listener_mock.id)
        self.assertEqual([{constants.LISTENER_ID: LISTENER_ID}], result)

    def test_get_vip_from_loadbalancer(self,
                                       mock_generate_uuid,
                                       mock_LOG,
                                       mock_get_session,
                                       mock_loadbalancer_repo_update,
                                       mock_listener_repo_update,
                                       mock_amphora_repo_update,
                                       mock_amphora_repo_delete):
        _loadbalancer_mock.vip = _vip_mock
        get_vip_from_lb_obj = database_tasks.GetVipFromLoadbalancer()
        result = get_vip_from_lb_obj.execute(_loadbalancer_mock)
        self.assertEqual(_vip_mock, result)

    @mock.patch('octavia.db.repositories.VRRPGroupRepository.create')
    def test_create_vrrp_group_for_lb(self,
                                      mock_vrrp_group_create,
                                      mock_generate_uuid,
                                      mock_LOG,
                                      mock_get_session,
                                      mock_loadbalancer_repo_update,
                                      mock_listener_repo_update,
                                      mock_amphora_repo_update,
                                      mock_amphora_repo_delete):

        mock_get_session.side_effect = ['TEST',
                                        odb_exceptions.DBDuplicateEntry]
        create_vrrp_group = database_tasks.CreateVRRPGroupForLB()
        create_vrrp_group.execute(_loadbalancer_mock)
        mock_vrrp_group_create.assert_called_once_with(
            'TEST', load_balancer_id=LB_ID,
            vrrp_group_name=LB_ID.replace('-', ''),
            vrrp_auth_type=constants.VRRP_AUTH_DEFAULT,
            vrrp_auth_pass=mock_generate_uuid.return_value.replace('-',
                                                                   '')[0:7],
            advert_int=1)
        create_vrrp_group.execute(_loadbalancer_mock)

    @mock.patch('octavia.db.repositories.AmphoraHealthRepository.delete')
    def test_disable_amphora_health_monitoring(self,
                                               mock_amp_health_repo_delete,
                                               mock_generate_uuid,
                                               mock_LOG,
                                               mock_get_session,
                                               mock_loadbalancer_repo_update,
                                               mock_listener_repo_update,
                                               mock_amphora_repo_update,
                                               mock_amphora_repo_delete):
        disable_amp_health = database_tasks.DisableAmphoraHealthMonitoring()
        disable_amp_health.execute(_amphora_mock)
        mock_amp_health_repo_delete.assert_called_once_with(
            'TEST', amphora_id=AMP_ID)

    @mock.patch('octavia.db.repositories.AmphoraHealthRepository.delete')
    def test_disable_lb_amphorae_health_monitoring(
            self,
            mock_amp_health_repo_delete,
            mock_generate_uuid,
            mock_LOG,
            mock_get_session,
            mock_loadbalancer_repo_update,
            mock_listener_repo_update,
            mock_amphora_repo_update,
            mock_amphora_repo_delete):
        disable_amp_health = (
            database_tasks.DisableLBAmphoraeHealthMonitoring())
        disable_amp_health.execute(_loadbalancer_mock)
        mock_amp_health_repo_delete.assert_called_once_with(
            'TEST', amphora_id=AMP_ID)

    @mock.patch('octavia.db.repositories.AmphoraHealthRepository.update')
    def test_mark_amphora_health_monitoring_busy(self,
                                                 mock_amp_health_repo_update,
                                                 mock_generate_uuid,
                                                 mock_LOG,
                                                 mock_get_session,
                                                 mock_loadbalancer_repo_update,
                                                 mock_listener_repo_update,
                                                 mock_amphora_repo_update,
                                                 mock_amphora_repo_delete):
        mark_busy = database_tasks.MarkAmphoraHealthBusy()
        mark_busy.execute(_amphora_mock)
        mock_amp_health_repo_update.assert_called_once_with(
            'TEST', amphora_id=AMP_ID, busy=True)

    @mock.patch('octavia.db.repositories.AmphoraHealthRepository.update')
    def test_mark_lb_amphorae_health_monitoring_busy(
            self,
            mock_amp_health_repo_update,
            mock_generate_uuid,
            mock_LOG,
            mock_get_session,
            mock_loadbalancer_repo_update,
            mock_listener_repo_update,
            mock_amphora_repo_update,
            mock_amphora_repo_delete):
        mark_busy = (
            database_tasks.MarkLBAmphoraeHealthBusy())
        mark_busy.execute(_loadbalancer_mock)
        mock_amp_health_repo_update.assert_called_once_with(
            'TEST', amphora_id=AMP_ID, busy=True)

    def test_update_lb_server_group_in_db(self,
                                          mock_generate_uuid,
                                          mock_LOG,
                                          mock_get_session,
                                          mock_loadbalancer_repo_update,
                                          mock_listener_repo_update,
                                          mock_amphora_repo_update,
                                          mock_amphora_repo_delete):

        update_server_group_info = database_tasks.UpdateLBServerGroupInDB()
        update_server_group_info.execute(LB_ID, SERVER_GROUP_ID)

        repo.LoadBalancerRepository.update.assert_called_once_with(
            'TEST',
            id=LB_ID,
            server_group_id=SERVER_GROUP_ID)

        # Test the revert
        mock_listener_repo_update.reset_mock()
        update_server_group_info.revert(LB_ID, SERVER_GROUP_ID)

        # Test the revert with exception
        mock_listener_repo_update.reset_mock()
        mock_loadbalancer_repo_update.side_effect = Exception('fail')
        update_server_group_info.revert(LB_ID, SERVER_GROUP_ID)

    @mock.patch('octavia.db.repositories.HealthMonitorRepository.update')
    def test_mark_health_mon_active_in_db(self,
                                          mock_health_mon_repo_update,
                                          mock_generate_uuid,
                                          mock_LOG,
                                          mock_get_session,
                                          mock_loadbalancer_repo_update,
                                          mock_listener_repo_update,
                                          mock_amphora_repo_update,
                                          mock_amphora_repo_delete):

        mark_health_mon_active = (database_tasks.MarkHealthMonitorActiveInDB())
        mark_health_mon_active.execute(self.health_mon_mock)

        mock_health_mon_repo_update.assert_called_once_with(
            'TEST',
            HM_ID,
            operating_status=constants.ONLINE,
            provisioning_status=constants.ACTIVE)

        # Test the revert
        mock_health_mon_repo_update.reset_mock()
        mark_health_mon_active.revert(self.health_mon_mock)

        mock_health_mon_repo_update.assert_called_once_with(
            'TEST',
            id=HM_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_health_mon_repo_update.reset_mock()
        mock_health_mon_repo_update.side_effect = Exception('fail')
        mark_health_mon_active.revert(self.health_mon_mock)

        mock_health_mon_repo_update.assert_called_once_with(
            'TEST',
            id=HM_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.HealthMonitorRepository.update')
    def test_mark_health_mon_pending_create_in_db(
            self,
            mock_health_mon_repo_update,
            mock_generate_uuid,
            mock_LOG,
            mock_get_session,
            mock_loadbalancer_repo_update,
            mock_listener_repo_update,
            mock_amphora_repo_update,
            mock_amphora_repo_delete):

        mark_health_mon_pending_create = (database_tasks.
                                          MarkHealthMonitorPendingCreateInDB())
        mark_health_mon_pending_create.execute(self.health_mon_mock)

        mock_health_mon_repo_update.assert_called_once_with(
            'TEST',
            HM_ID,
            provisioning_status=constants.PENDING_CREATE)

        # Test the revert
        mock_health_mon_repo_update.reset_mock()
        mark_health_mon_pending_create.revert(self.health_mon_mock)

        mock_health_mon_repo_update.assert_called_once_with(
            'TEST',
            id=HM_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_health_mon_repo_update.reset_mock()
        mock_health_mon_repo_update.side_effect = Exception('fail')
        mark_health_mon_pending_create.revert(self.health_mon_mock)

        mock_health_mon_repo_update.assert_called_once_with(
            'TEST',
            id=HM_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.HealthMonitorRepository.update')
    def test_mark_health_mon_pending_delete_in_db(
            self,
            mock_health_mon_repo_update,
            mock_generate_uuid,
            mock_LOG,
            mock_get_session,
            mock_loadbalancer_repo_update,
            mock_listener_repo_update,
            mock_amphora_repo_update,
            mock_amphora_repo_delete):

        mark_health_mon_pending_delete = (database_tasks.
                                          MarkHealthMonitorPendingDeleteInDB())
        mark_health_mon_pending_delete.execute(self.health_mon_mock)

        mock_health_mon_repo_update.assert_called_once_with(
            'TEST',
            HM_ID,
            provisioning_status=constants.PENDING_DELETE)

        # Test the revert
        mock_health_mon_repo_update.reset_mock()
        mark_health_mon_pending_delete.revert(self.health_mon_mock)

        mock_health_mon_repo_update.assert_called_once_with(
            'TEST',
            id=HM_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_health_mon_repo_update.reset_mock()
        mock_health_mon_repo_update.side_effect = Exception('fail')
        mark_health_mon_pending_delete.revert(self.health_mon_mock)

        mock_health_mon_repo_update.assert_called_once_with(
            'TEST',
            id=HM_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.HealthMonitorRepository.update')
    def test_mark_health_mon_pending_update_in_db(
            self,
            mock_health_mon_repo_update,
            mock_generate_uuid,
            mock_LOG,
            mock_get_session,
            mock_loadbalancer_repo_update,
            mock_listener_repo_update,
            mock_amphora_repo_update,
            mock_amphora_repo_delete):

        mark_health_mon_pending_update = (database_tasks.
                                          MarkHealthMonitorPendingUpdateInDB())
        mark_health_mon_pending_update.execute(self.health_mon_mock)

        mock_health_mon_repo_update.assert_called_once_with(
            'TEST',
            HM_ID,
            provisioning_status=constants.PENDING_UPDATE)

        # Test the revert
        mock_health_mon_repo_update.reset_mock()
        mark_health_mon_pending_update.revert(self.health_mon_mock)

        mock_health_mon_repo_update.assert_called_once_with(
            'TEST',
            id=HM_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_health_mon_repo_update.reset_mock()
        mock_health_mon_repo_update.side_effect = Exception('fail')
        mark_health_mon_pending_update.revert(self.health_mon_mock)

        mock_health_mon_repo_update.assert_called_once_with(
            'TEST',
            id=HM_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.L7PolicyRepository.update')
    def test_mark_l7policy_active_in_db(self,
                                        mock_l7policy_repo_update,
                                        mock_generate_uuid,
                                        mock_LOG,
                                        mock_get_session,
                                        mock_loadbalancer_repo_update,
                                        mock_listener_repo_update,
                                        mock_amphora_repo_update,
                                        mock_amphora_repo_delete):

        mark_l7policy_active = (database_tasks.MarkL7PolicyActiveInDB())
        mark_l7policy_active.execute(self.l7policy_mock)

        mock_l7policy_repo_update.assert_called_once_with(
            'TEST',
            L7POLICY_ID,
            provisioning_status=constants.ACTIVE,
            operating_status=constants.ONLINE)

        # Test the revert
        mock_l7policy_repo_update.reset_mock()
        mark_l7policy_active.revert(self.l7policy_mock)

        mock_l7policy_repo_update.assert_called_once_with(
            'TEST',
            id=L7POLICY_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_l7policy_repo_update.reset_mock()
        mock_l7policy_repo_update.side_effect = Exception('fail')
        mark_l7policy_active.revert(self.l7policy_mock)

        mock_l7policy_repo_update.assert_called_once_with(
            'TEST',
            id=L7POLICY_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.L7PolicyRepository.update')
    def test_mark_l7policy_pending_create_in_db(self,
                                                mock_l7policy_repo_update,
                                                mock_generate_uuid,
                                                mock_LOG,
                                                mock_get_session,
                                                mock_loadbalancer_repo_update,
                                                mock_listener_repo_update,
                                                mock_amphora_repo_update,
                                                mock_amphora_repo_delete):

        mark_l7policy_pending_create = (database_tasks.
                                        MarkL7PolicyPendingCreateInDB())
        mark_l7policy_pending_create.execute(self.l7policy_mock)

        mock_l7policy_repo_update.assert_called_once_with(
            'TEST',
            L7POLICY_ID,
            provisioning_status=constants.PENDING_CREATE)

        # Test the revert
        mock_l7policy_repo_update.reset_mock()
        mark_l7policy_pending_create.revert(self.l7policy_mock)

        mock_l7policy_repo_update.assert_called_once_with(
            'TEST',
            id=L7POLICY_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_l7policy_repo_update.reset_mock()
        mock_l7policy_repo_update.side_effect = Exception('fail')
        mark_l7policy_pending_create.revert(self.l7policy_mock)

        mock_l7policy_repo_update.assert_called_once_with(
            'TEST',
            id=L7POLICY_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.L7PolicyRepository.update')
    def test_mark_l7policy_pending_delete_in_db(self,
                                                mock_l7policy_repo_update,
                                                mock_generate_uuid,
                                                mock_LOG,
                                                mock_get_session,
                                                mock_loadbalancer_repo_update,
                                                mock_listener_repo_update,
                                                mock_amphora_repo_update,
                                                mock_amphora_repo_delete):

        mark_l7policy_pending_delete = (database_tasks.
                                        MarkL7PolicyPendingDeleteInDB())
        mark_l7policy_pending_delete.execute(self.l7policy_mock)

        mock_l7policy_repo_update.assert_called_once_with(
            'TEST',
            L7POLICY_ID,
            provisioning_status=constants.PENDING_DELETE)

        # Test the revert
        mock_l7policy_repo_update.reset_mock()
        mark_l7policy_pending_delete.revert(self.l7policy_mock)

        mock_l7policy_repo_update.assert_called_once_with(
            'TEST',
            id=L7POLICY_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_l7policy_repo_update.reset_mock()
        mock_l7policy_repo_update.side_effect = Exception('fail')
        mark_l7policy_pending_delete.revert(self.l7policy_mock)

        mock_l7policy_repo_update.assert_called_once_with(
            'TEST',
            id=L7POLICY_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.L7PolicyRepository.update')
    def test_mark_l7policy_pending_update_in_db(self,
                                                mock_l7policy_repo_update,
                                                mock_generate_uuid,
                                                mock_LOG,
                                                mock_get_session,
                                                mock_loadbalancer_repo_update,
                                                mock_listener_repo_update,
                                                mock_amphora_repo_update,
                                                mock_amphora_repo_delete):

        mark_l7policy_pending_update = (database_tasks.
                                        MarkL7PolicyPendingUpdateInDB())
        mark_l7policy_pending_update.execute(self.l7policy_mock)

        mock_l7policy_repo_update.assert_called_once_with(
            'TEST',
            L7POLICY_ID,
            provisioning_status=constants.PENDING_UPDATE)

        # Test the revert
        mock_l7policy_repo_update.reset_mock()
        mark_l7policy_pending_update.revert(self.l7policy_mock)

        mock_l7policy_repo_update.assert_called_once_with(
            'TEST',
            id=L7POLICY_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_l7policy_repo_update.reset_mock()
        mock_l7policy_repo_update.side_effect = Exception('fail')
        mark_l7policy_pending_update.revert(self.l7policy_mock)

        mock_l7policy_repo_update.assert_called_once_with(
            'TEST',
            id=L7POLICY_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.L7RuleRepository.update')
    def test_mark_l7rule_active_in_db(self,
                                      mock_l7rule_repo_update,
                                      mock_generate_uuid,
                                      mock_LOG,
                                      mock_get_session,
                                      mock_loadbalancer_repo_update,
                                      mock_listener_repo_update,
                                      mock_amphora_repo_update,
                                      mock_amphora_repo_delete):

        mark_l7rule_active = (database_tasks.MarkL7RuleActiveInDB())
        mark_l7rule_active.execute(self.l7rule_mock)

        mock_l7rule_repo_update.assert_called_once_with(
            'TEST',
            L7RULE_ID,
            provisioning_status=constants.ACTIVE,
            operating_status=constants.ONLINE)

        # Test the revert
        mock_l7rule_repo_update.reset_mock()
        mark_l7rule_active.revert(self.l7rule_mock)

        mock_l7rule_repo_update.assert_called_once_with(
            'TEST',
            id=L7RULE_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_l7rule_repo_update.reset_mock()
        mock_l7rule_repo_update.side_effect = Exception('fail')
        mark_l7rule_active.revert(self.l7rule_mock)

        mock_l7rule_repo_update.assert_called_once_with(
            'TEST',
            id=L7RULE_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.L7RuleRepository.update')
    def test_mark_l7rule_pending_create_in_db(self,
                                              mock_l7rule_repo_update,
                                              mock_generate_uuid,
                                              mock_LOG,
                                              mock_get_session,
                                              mock_loadbalancer_repo_update,
                                              mock_listener_repo_update,
                                              mock_amphora_repo_update,
                                              mock_amphora_repo_delete):

        mark_l7rule_pending_create = (database_tasks.
                                      MarkL7RulePendingCreateInDB())
        mark_l7rule_pending_create.execute(self.l7rule_mock)

        mock_l7rule_repo_update.assert_called_once_with(
            'TEST',
            L7RULE_ID,
            provisioning_status=constants.PENDING_CREATE)

        # Test the revert
        mock_l7rule_repo_update.reset_mock()
        mark_l7rule_pending_create.revert(self.l7rule_mock)

        mock_l7rule_repo_update.assert_called_once_with(
            'TEST',
            id=L7RULE_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_l7rule_repo_update.reset_mock()
        mock_l7rule_repo_update.side_effect = Exception('fail')
        mark_l7rule_pending_create.revert(self.l7rule_mock)

        mock_l7rule_repo_update.assert_called_once_with(
            'TEST',
            id=L7RULE_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.L7RuleRepository.update')
    def test_mark_l7rule_pending_delete_in_db(self,
                                              mock_l7rule_repo_update,
                                              mock_generate_uuid,
                                              mock_LOG,
                                              mock_get_session,
                                              mock_loadbalancer_repo_update,
                                              mock_listener_repo_update,
                                              mock_amphora_repo_update,
                                              mock_amphora_repo_delete):

        mark_l7rule_pending_delete = (database_tasks.
                                      MarkL7RulePendingDeleteInDB())
        mark_l7rule_pending_delete.execute(self.l7rule_mock)

        mock_l7rule_repo_update.assert_called_once_with(
            'TEST',
            L7RULE_ID,
            provisioning_status=constants.PENDING_DELETE)

        # Test the revert
        mock_l7rule_repo_update.reset_mock()
        mark_l7rule_pending_delete.revert(self.l7rule_mock)

        mock_l7rule_repo_update.assert_called_once_with(
            'TEST',
            id=L7RULE_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_l7rule_repo_update.reset_mock()
        mock_l7rule_repo_update.side_effect = Exception('fail')
        mark_l7rule_pending_delete.revert(self.l7rule_mock)

        mock_l7rule_repo_update.assert_called_once_with(
            'TEST',
            id=L7RULE_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.L7RuleRepository.update')
    def test_mark_l7rule_pending_update_in_db(self,
                                              mock_l7rule_repo_update,
                                              mock_generate_uuid,
                                              mock_LOG,
                                              mock_get_session,
                                              mock_loadbalancer_repo_update,
                                              mock_listener_repo_update,
                                              mock_amphora_repo_update,
                                              mock_amphora_repo_delete):

        mark_l7rule_pending_update = (database_tasks.
                                      MarkL7RulePendingUpdateInDB())
        mark_l7rule_pending_update.execute(self.l7rule_mock)

        mock_l7rule_repo_update.assert_called_once_with(
            'TEST',
            L7RULE_ID,
            provisioning_status=constants.PENDING_UPDATE)

        # Test the revert
        mock_l7rule_repo_update.reset_mock()
        mark_l7rule_pending_update.revert(self.l7rule_mock)

        mock_l7rule_repo_update.assert_called_once_with(
            'TEST',
            id=L7RULE_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_l7rule_repo_update.reset_mock()
        mock_l7rule_repo_update.side_effect = Exception('fail')
        mark_l7rule_pending_update.revert(self.l7rule_mock)

        mock_l7rule_repo_update.assert_called_once_with(
            'TEST',
            id=L7RULE_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.MemberRepository.update')
    def test_mark_member_active_in_db(self,
                                      mock_member_repo_update,
                                      mock_generate_uuid,
                                      mock_LOG,
                                      mock_get_session,
                                      mock_loadbalancer_repo_update,
                                      mock_listener_repo_update,
                                      mock_amphora_repo_update,
                                      mock_amphora_repo_delete):

        mark_member_active = (database_tasks.MarkMemberActiveInDB())
        mark_member_active.execute(self.member_mock)

        mock_member_repo_update.assert_called_once_with(
            'TEST',
            MEMBER_ID,
            provisioning_status=constants.ACTIVE)

        # Test the revert
        mock_member_repo_update.reset_mock()
        mark_member_active.revert(self.member_mock)

        mock_member_repo_update.assert_called_once_with(
            'TEST',
            id=MEMBER_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_member_repo_update.reset_mock()
        mock_member_repo_update.side_effect = Exception('fail')
        mark_member_active.revert(self.member_mock)

        mock_member_repo_update.assert_called_once_with(
            'TEST',
            id=MEMBER_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.MemberRepository.update')
    def test_mark_member_pending_create_in_db(self,
                                              mock_member_repo_update,
                                              mock_generate_uuid,
                                              mock_LOG,
                                              mock_get_session,
                                              mock_loadbalancer_repo_update,
                                              mock_listener_repo_update,
                                              mock_amphora_repo_update,
                                              mock_amphora_repo_delete):

        mark_member_pending_create = (database_tasks.
                                      MarkMemberPendingCreateInDB())
        mark_member_pending_create.execute(self.member_mock)

        mock_member_repo_update.assert_called_once_with(
            'TEST',
            MEMBER_ID,
            provisioning_status=constants.PENDING_CREATE)

        # Test the revert
        mock_member_repo_update.reset_mock()
        mark_member_pending_create.revert(self.member_mock)

        mock_member_repo_update.assert_called_once_with(
            'TEST',
            id=MEMBER_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_member_repo_update.reset_mock()
        mock_member_repo_update.side_effect = Exception('fail')
        mark_member_pending_create.revert(self.member_mock)

        mock_member_repo_update.assert_called_once_with(
            'TEST',
            id=MEMBER_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.MemberRepository.update')
    def test_mark_member_pending_delete_in_db(self,
                                              mock_member_repo_update,
                                              mock_generate_uuid,
                                              mock_LOG,
                                              mock_get_session,
                                              mock_loadbalancer_repo_update,
                                              mock_listener_repo_update,
                                              mock_amphora_repo_update,
                                              mock_amphora_repo_delete):

        mark_member_pending_delete = (database_tasks.
                                      MarkMemberPendingDeleteInDB())
        mark_member_pending_delete.execute(self.member_mock)

        mock_member_repo_update.assert_called_once_with(
            'TEST',
            MEMBER_ID,
            provisioning_status=constants.PENDING_DELETE)

        # Test the revert
        mock_member_repo_update.reset_mock()
        mark_member_pending_delete.revert(self.member_mock)

        mock_member_repo_update.assert_called_once_with(
            'TEST',
            id=MEMBER_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_member_repo_update.reset_mock()
        mock_member_repo_update.side_effect = Exception('fail')
        mark_member_pending_delete.revert(self.member_mock)

        mock_member_repo_update.assert_called_once_with(
            'TEST',
            id=MEMBER_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.MemberRepository.update')
    def test_mark_member_pending_update_in_db(self,
                                              mock_member_repo_update,
                                              mock_generate_uuid,
                                              mock_LOG,
                                              mock_get_session,
                                              mock_loadbalancer_repo_update,
                                              mock_listener_repo_update,
                                              mock_amphora_repo_update,
                                              mock_amphora_repo_delete):

        mark_member_pending_update = (database_tasks.
                                      MarkMemberPendingUpdateInDB())
        mark_member_pending_update.execute(self.member_mock)

        mock_member_repo_update.assert_called_once_with(
            'TEST',
            MEMBER_ID,
            provisioning_status=constants.PENDING_UPDATE)

        # Test the revert
        mock_member_repo_update.reset_mock()
        mark_member_pending_update.revert(self.member_mock)

        mock_member_repo_update.assert_called_once_with(
            'TEST',
            id=MEMBER_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_member_repo_update.reset_mock()
        mock_member_repo_update.side_effect = Exception('fail')
        mark_member_pending_update.revert(self.member_mock)

        mock_member_repo_update.assert_called_once_with(
            'TEST',
            id=MEMBER_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.PoolRepository.update')
    def test_mark_pool_active_in_db(self,
                                    mock_pool_repo_update,
                                    mock_generate_uuid,
                                    mock_LOG,
                                    mock_get_session,
                                    mock_loadbalancer_repo_update,
                                    mock_listener_repo_update,
                                    mock_amphora_repo_update,
                                    mock_amphora_repo_delete):

        mark_pool_active = (database_tasks.MarkPoolActiveInDB())
        mark_pool_active.execute(POOL_ID)

        mock_pool_repo_update.assert_called_once_with(
            'TEST',
            POOL_ID,
            provisioning_status=constants.ACTIVE)

        # Test the revert
        mock_pool_repo_update.reset_mock()
        mark_pool_active.revert(POOL_ID)

        mock_pool_repo_update.assert_called_once_with(
            'TEST',
            id=POOL_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_pool_repo_update.reset_mock()
        mock_pool_repo_update.side_effect = Exception('fail')
        mark_pool_active.revert(POOL_ID)

        mock_pool_repo_update.assert_called_once_with(
            'TEST',
            id=POOL_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.PoolRepository.update')
    def test_mark_pool_pending_create_in_db(self,
                                            mock_pool_repo_update,
                                            mock_generate_uuid,
                                            mock_LOG,
                                            mock_get_session,
                                            mock_loadbalancer_repo_update,
                                            mock_listener_repo_update,
                                            mock_amphora_repo_update,
                                            mock_amphora_repo_delete):

        mark_pool_pending_create = (database_tasks.MarkPoolPendingCreateInDB())
        mark_pool_pending_create.execute(POOL_ID)

        mock_pool_repo_update.assert_called_once_with(
            'TEST',
            POOL_ID,
            provisioning_status=constants.PENDING_CREATE)

        # Test the revert
        mock_pool_repo_update.reset_mock()
        mark_pool_pending_create.revert(POOL_ID)

        mock_pool_repo_update.assert_called_once_with(
            'TEST',
            id=POOL_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_pool_repo_update.reset_mock()
        mock_pool_repo_update.side_effect = Exception('fail')
        mark_pool_pending_create.revert(POOL_ID)

        mock_pool_repo_update.assert_called_once_with(
            'TEST',
            id=POOL_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.PoolRepository.update')
    def test_mark_pool_pending_delete_in_db(self,
                                            mock_pool_repo_update,
                                            mock_generate_uuid,
                                            mock_LOG,
                                            mock_get_session,
                                            mock_loadbalancer_repo_update,
                                            mock_listener_repo_update,
                                            mock_amphora_repo_update,
                                            mock_amphora_repo_delete):

        mark_pool_pending_delete = (database_tasks.MarkPoolPendingDeleteInDB())
        mark_pool_pending_delete.execute(POOL_ID)

        mock_pool_repo_update.assert_called_once_with(
            'TEST',
            POOL_ID,
            provisioning_status=constants.PENDING_DELETE)

        # Test the revert
        mock_pool_repo_update.reset_mock()
        mark_pool_pending_delete.revert(POOL_ID)

        mock_pool_repo_update.assert_called_once_with(
            'TEST',
            id=POOL_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_pool_repo_update.reset_mock()
        mock_pool_repo_update.side_effect = Exception('fail')
        mark_pool_pending_delete.revert(POOL_ID)

        mock_pool_repo_update.assert_called_once_with(
            'TEST',
            id=POOL_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.PoolRepository.update')
    def test_mark_pool_pending_update_in_db(self,
                                            mock_pool_repo_update,
                                            mock_generate_uuid,
                                            mock_LOG,
                                            mock_get_session,
                                            mock_loadbalancer_repo_update,
                                            mock_listener_repo_update,
                                            mock_amphora_repo_update,
                                            mock_amphora_repo_delete):

        mark_pool_pending_update = (database_tasks.
                                    MarkPoolPendingUpdateInDB())
        mark_pool_pending_update.execute(POOL_ID)

        mock_pool_repo_update.assert_called_once_with(
            'TEST',
            POOL_ID,
            provisioning_status=constants.PENDING_UPDATE)

        # Test the revert
        mock_pool_repo_update.reset_mock()
        mark_pool_pending_update.revert(POOL_ID)

        mock_pool_repo_update.assert_called_once_with(
            'TEST',
            id=POOL_ID,
            provisioning_status=constants.ERROR)

        # Test the revert with exception
        mock_pool_repo_update.reset_mock()
        mock_pool_repo_update.side_effect = Exception('fail')
        mark_pool_pending_update.revert(POOL_ID)

        mock_pool_repo_update.assert_called_once_with(
            'TEST',
            id=POOL_ID,
            provisioning_status=constants.ERROR)

    @mock.patch('octavia.db.repositories.MemberRepository.update_pool_members')
    def test_update_pool_members_operating_status_in_db(
            self,
            mock_member_repo_update_pool_members,
            mock_generate_uuid,
            mock_LOG,
            mock_get_session,
            mock_loadbalancer_repo_update,
            mock_listener_repo_update,
            mock_amphora_repo_update,
            mock_amphora_repo_delete):

        update_members = database_tasks.UpdatePoolMembersOperatingStatusInDB()
        update_members.execute(POOL_ID, constants.ONLINE)

        mock_member_repo_update_pool_members.assert_called_once_with(
            'TEST',
            POOL_ID,
            operating_status=constants.ONLINE)

[((1076, 1101), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1099, 1101), False, 'from oslo_utils import uuidutils\n'), ((1115, 1140), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1138, 1140), False, 'from oslo_utils import uuidutils\n'), ((1149, 1174), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1172, 1174), False, 'from oslo_utils import uuidutils\n'), ((1193, 1218), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1216, 1218), False, 'from oslo_utils import uuidutils\n'), ((1257, 1282), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1280, 1282), False, 'from oslo_utils import uuidutils\n'), ((1293, 1318), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1316, 1318), False, 'from oslo_utils import uuidutils\n'), ((1327, 1352), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1350, 1352), False, 'from oslo_utils import uuidutils\n'), ((1365, 1390), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1388, 1390), False, 'from oslo_utils import uuidutils\n'), ((1401, 1426), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1424, 1426), False, 'from oslo_utils import uuidutils\n'), ((1439, 1464), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1462, 1464), False, 'from oslo_utils import uuidutils\n'), ((1480, 1505), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1503, 1505), False, 'from oslo_utils import uuidutils\n'), ((1519, 1544), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1542, 1544), False, 'from oslo_utils import uuidutils\n'), ((1559, 1584), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1582, 1584), False, 'from oslo_utils import uuidutils\n'), ((1597, 1622), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1620, 1622), False, 'from oslo_utils import uuidutils\n'), ((1719, 1740), 'random.randrange', 'random.randrange', (['(255)'], {}), '(255)\n', (1735, 1740), False, 'import random\n'), ((1757, 1778), 'random.randrange', 'random.randrange', (['(100)'], {}), '(100)\n', (1773, 1778), False, 'import random\n'), ((1812, 1837), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1835, 1837), False, 'from oslo_utils import uuidutils\n'), ((1855, 1880), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (1878, 1880), False, 'from oslo_utils import uuidutils\n'), ((1898, 1914), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (1912, 1914), False, 'import mock\n'), ((2314, 2330), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (2328, 2330), False, 'import mock\n'), ((2424, 2440), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (2438, 2440), False, 'import mock\n'), ((2488, 2504), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (2502, 2504), False, 'import mock\n'), ((2550, 2566), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (2564, 2566), False, 'import mock\n'), ((2592, 2640), 'mock.MagicMock', 'mock.MagicMock', ([], {'return_value': "{'id': LISTENER_ID}"}), "(return_value={'id': LISTENER_ID})\n", (2606, 2640), False, 'import mock\n'), ((2745, 2776), 'mock.Mock', 'mock.Mock', ([], {'spec': 'failure.Failure'}), '(spec=failure.Failure)\n', (2754, 2776), False, 'import mock\n'), ((2789, 2805), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (2803, 2805), False, 'import mock\n'), ((2915, 2931), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (2929, 2931), False, 'import mock\n'), ((2945, 2961), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (2959, 2961), False, 'import mock\n'), ((2978, 2994), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (2992, 2994), False, 'import mock\n'), ((3158, 3220), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraRepository.delete"""'], {}), "('octavia.db.repositories.AmphoraRepository.delete')\n", (3168, 3220), False, 'import mock\n'), ((3222, 3284), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraRepository.update"""'], {}), "('octavia.db.repositories.AmphoraRepository.update')\n", (3232, 3284), False, 'import mock\n'), ((3286, 3349), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.ListenerRepository.update"""'], {}), "('octavia.db.repositories.ListenerRepository.update')\n", (3296, 3349), False, 'import mock\n'), ((3351, 3418), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.LoadBalancerRepository.update"""'], {}), "('octavia.db.repositories.LoadBalancerRepository.update')\n", (3361, 3418), False, 'import mock\n'), ((3420, 3481), 'mock.patch', 'mock.patch', (['"""octavia.db.api.get_session"""'], {'return_value': '"""TEST"""'}), "('octavia.db.api.get_session', return_value='TEST')\n", (3430, 3481), False, 'import mock\n'), ((3483, 3550), 'mock.patch', 'mock.patch', (['"""octavia.controller.worker.v2.tasks.database_tasks.LOG"""'], {}), "('octavia.controller.worker.v2.tasks.database_tasks.LOG')\n", (3493, 3550), False, 'import mock\n'), ((3552, 3621), 'mock.patch', 'mock.patch', (['"""oslo_utils.uuidutils.generate_uuid"""'], {'return_value': 'AMP_ID'}), "('oslo_utils.uuidutils.generate_uuid', return_value=AMP_ID)\n", (3562, 3621), False, 'import mock\n'), ((4647, 4742), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraRepository.create"""'], {'return_value': '_amphora_mock'}), "('octavia.db.repositories.AmphoraRepository.create', return_value\n    =_amphora_mock)\n", (4657, 4742), False, 'import mock\n'), ((6321, 6384), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.ListenerRepository.delete"""'], {}), "('octavia.db.repositories.ListenerRepository.delete')\n", (6331, 6384), False, 'import mock\n'), ((7351, 7419), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.HealthMonitorRepository.update"""'], {}), "('octavia.db.repositories.HealthMonitorRepository.update')\n", (7361, 7419), False, 'import mock\n'), ((7425, 7493), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.HealthMonitorRepository.delete"""'], {}), "('octavia.db.repositories.HealthMonitorRepository.delete')\n", (7435, 7493), False, 'import mock\n'), ((8940, 9008), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.HealthMonitorRepository.update"""'], {}), "('octavia.db.repositories.HealthMonitorRepository.update')\n", (8950, 9008), False, 'import mock\n'), ((9014, 9082), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.HealthMonitorRepository.delete"""'], {}), "('octavia.db.repositories.HealthMonitorRepository.delete')\n", (9024, 9082), False, 'import mock\n'), ((10523, 10584), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.MemberRepository.delete"""'], {}), "('octavia.db.repositories.MemberRepository.delete')\n", (10533, 10584), False, 'import mock\n'), ((11543, 11602), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.PoolRepository.delete"""'], {}), "('octavia.db.repositories.PoolRepository.delete')\n", (11553, 11602), False, 'import mock\n'), ((12552, 12615), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7PolicyRepository.delete"""'], {}), "('octavia.db.repositories.L7PolicyRepository.delete')\n", (12562, 12615), False, 'import mock\n'), ((13657, 13718), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7RuleRepository.delete"""'], {}), "('octavia.db.repositories.L7RuleRepository.delete')\n", (13667, 13718), False, 'import mock\n'), ((14722, 14814), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraRepository.get"""'], {'return_value': '_amphora_mock'}), "('octavia.db.repositories.AmphoraRepository.get', return_value=\n    _amphora_mock)\n", (14732, 14814), False, 'import mock\n'), ((15507, 15608), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.LoadBalancerRepository.get"""'], {'return_value': '_loadbalancer_mock'}), "('octavia.db.repositories.LoadBalancerRepository.get',\n    return_value=_loadbalancer_mock)\n", (15517, 15608), False, 'import mock\n'), ((16364, 16465), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.LoadBalancerRepository.get"""'], {'return_value': '_loadbalancer_mock'}), "('octavia.db.repositories.LoadBalancerRepository.get',\n    return_value=_loadbalancer_mock)\n", (16374, 16465), False, 'import mock\n'), ((16483, 16541), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.VipRepository.update"""'], {}), "('octavia.db.repositories.VipRepository.update')\n", (16493, 16541), False, 'import mock\n'), ((20347, 20412), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraRepository.associate"""'], {}), "('octavia.db.repositories.AmphoraRepository.associate')\n", (20357, 20412), False, 'import mock\n'), ((21760, 21877), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraRepository.allocate_and_associate"""'], {'side_effect': '[_amphora_mock, None]'}), "('octavia.db.repositories.AmphoraRepository.allocate_and_associate',\n    side_effect=[_amphora_mock, None])\n", (21770, 21877), False, 'import mock\n'), ((23531, 23648), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraRepository.allocate_and_associate"""'], {'side_effect': '[_amphora_mock, None]'}), "('octavia.db.repositories.AmphoraRepository.allocate_and_associate',\n    side_effect=[_amphora_mock, None])\n", (23541, 23648), False, 'import mock\n'), ((25462, 25554), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraRepository.get"""'], {'return_value': '_amphora_mock'}), "('octavia.db.repositories.AmphoraRepository.get', return_value=\n    _amphora_mock)\n", (25472, 25554), False, 'import mock\n'), ((25571, 25672), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.LoadBalancerRepository.get"""'], {'return_value': '_loadbalancer_mock'}), "('octavia.db.repositories.LoadBalancerRepository.get',\n    return_value=_loadbalancer_mock)\n", (25581, 25672), False, 'import mock\n'), ((26665, 26757), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraRepository.get"""'], {'return_value': '_amphora_mock'}), "('octavia.db.repositories.AmphoraRepository.get', return_value=\n    _amphora_mock)\n", (26675, 26757), False, 'import mock\n'), ((26774, 26875), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.LoadBalancerRepository.get"""'], {'return_value': '_loadbalancer_mock'}), "('octavia.db.repositories.LoadBalancerRepository.get',\n    return_value=_loadbalancer_mock)\n", (26784, 26875), False, 'import mock\n'), ((36518, 36577), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraRepository.get"""'], {}), "('octavia.db.repositories.AmphoraRepository.get')\n", (36528, 36577), False, 'import mock\n'), ((40606, 40704), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.ListenerRepository.prov_status_active_if_not_error"""'], {}), "(\n    'octavia.db.repositories.ListenerRepository.prov_status_active_if_not_error'\n    )\n", (40616, 40704), False, 'import mock\n'), ((44782, 44881), 'mock.patch', 'mock.patch', (['"""octavia.common.tls_utils.cert_parser.get_cert_expiration"""'], {'return_value': '_cert_mock'}), "('octavia.common.tls_utils.cert_parser.get_cert_expiration',\n    return_value=_cert_mock)\n", (44792, 44881), False, 'import mock\n'), ((52103, 52162), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.PoolRepository.update"""'], {}), "('octavia.db.repositories.PoolRepository.update')\n", (52113, 52162), False, 'import mock\n'), ((52168, 52229), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.MemberRepository.update"""'], {}), "('octavia.db.repositories.MemberRepository.update')\n", (52178, 52229), False, 'import mock\n'), ((52235, 52303), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.HealthMonitorRepository.update"""'], {}), "('octavia.db.repositories.HealthMonitorRepository.update')\n", (52245, 52303), False, 'import mock\n'), ((52309, 52372), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7PolicyRepository.update"""'], {}), "('octavia.db.repositories.L7PolicyRepository.update')\n", (52319, 52372), False, 'import mock\n'), ((52378, 52439), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7RuleRepository.update"""'], {}), "('octavia.db.repositories.L7RuleRepository.update')\n", (52388, 52439), False, 'import mock\n'), ((61312, 61380), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.HealthMonitorRepository.update"""'], {}), "('octavia.db.repositories.HealthMonitorRepository.update')\n", (61322, 61380), False, 'import mock\n'), ((64469, 64527), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.VipRepository.update"""'], {}), "('octavia.db.repositories.VipRepository.update')\n", (64479, 64527), False, 'import mock\n'), ((67364, 67425), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.MemberRepository.update"""'], {}), "('octavia.db.repositories.MemberRepository.update')\n", (67374, 67425), False, 'import mock\n'), ((68860, 68929), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.Repositories.update_pool_and_sp"""'], {}), "('octavia.db.repositories.Repositories.update_pool_and_sp')\n", (68870, 68929), False, 'import mock\n'), ((70486, 70549), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7PolicyRepository.update"""'], {}), "('octavia.db.repositories.L7PolicyRepository.update')\n", (70496, 70549), False, 'import mock\n'), ((72053, 72114), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7RuleRepository.update"""'], {}), "('octavia.db.repositories.L7RuleRepository.update')\n", (72063, 72114), False, 'import mock\n'), ((72120, 72183), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7PolicyRepository.update"""'], {}), "('octavia.db.repositories.L7PolicyRepository.update')\n", (72130, 72183), False, 'import mock\n'), ((77488, 77547), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraRepository.get"""'], {}), "('octavia.db.repositories.AmphoraRepository.get')\n", (77498, 77547), False, 'import mock\n'), ((78589, 78649), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.ListenerRepository.get"""'], {}), "('octavia.db.repositories.ListenerRepository.get')\n", (78599, 78649), False, 'import mock\n'), ((80353, 80417), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.VRRPGroupRepository.create"""'], {}), "('octavia.db.repositories.VRRPGroupRepository.create')\n", (80363, 80417), False, 'import mock\n'), ((81634, 81702), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraHealthRepository.delete"""'], {}), "('octavia.db.repositories.AmphoraHealthRepository.delete')\n", (81644, 81702), False, 'import mock\n'), ((82553, 82621), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraHealthRepository.delete"""'], {}), "('octavia.db.repositories.AmphoraHealthRepository.delete')\n", (82563, 82621), False, 'import mock\n'), ((83232, 83300), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraHealthRepository.update"""'], {}), "('octavia.db.repositories.AmphoraHealthRepository.update')\n", (83242, 83300), False, 'import mock\n'), ((84153, 84221), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.AmphoraHealthRepository.update"""'], {}), "('octavia.db.repositories.AmphoraHealthRepository.update')\n", (84163, 84221), False, 'import mock\n'), ((85979, 86047), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.HealthMonitorRepository.update"""'], {}), "('octavia.db.repositories.HealthMonitorRepository.update')\n", (85989, 86047), False, 'import mock\n'), ((87627, 87695), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.HealthMonitorRepository.update"""'], {}), "('octavia.db.repositories.HealthMonitorRepository.update')\n", (87637, 87695), False, 'import mock\n'), ((89099, 89167), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.HealthMonitorRepository.update"""'], {}), "('octavia.db.repositories.HealthMonitorRepository.update')\n", (89109, 89167), False, 'import mock\n'), ((90571, 90639), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.HealthMonitorRepository.update"""'], {}), "('octavia.db.repositories.HealthMonitorRepository.update')\n", (90581, 90639), False, 'import mock\n'), ((92043, 92106), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7PolicyRepository.update"""'], {}), "('octavia.db.repositories.L7PolicyRepository.update')\n", (92053, 92106), False, 'import mock\n'), ((93653, 93716), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7PolicyRepository.update"""'], {}), "('octavia.db.repositories.L7PolicyRepository.update')\n", (93663, 93716), False, 'import mock\n'), ((95376, 95439), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7PolicyRepository.update"""'], {}), "('octavia.db.repositories.L7PolicyRepository.update')\n", (95386, 95439), False, 'import mock\n'), ((97099, 97162), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7PolicyRepository.update"""'], {}), "('octavia.db.repositories.L7PolicyRepository.update')\n", (97109, 97162), False, 'import mock\n'), ((98822, 98883), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7RuleRepository.update"""'], {}), "('octavia.db.repositories.L7RuleRepository.update')\n", (98832, 98883), False, 'import mock\n'), ((100376, 100437), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7RuleRepository.update"""'], {}), "('octavia.db.repositories.L7RuleRepository.update')\n", (100386, 100437), False, 'import mock\n'), ((102041, 102102), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7RuleRepository.update"""'], {}), "('octavia.db.repositories.L7RuleRepository.update')\n", (102051, 102102), False, 'import mock\n'), ((103706, 103767), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.L7RuleRepository.update"""'], {}), "('octavia.db.repositories.L7RuleRepository.update')\n", (103716, 103767), False, 'import mock\n'), ((105371, 105432), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.MemberRepository.update"""'], {}), "('octavia.db.repositories.MemberRepository.update')\n", (105381, 105432), False, 'import mock\n'), ((106878, 106939), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.MemberRepository.update"""'], {}), "('octavia.db.repositories.MemberRepository.update')\n", (106888, 106939), False, 'import mock\n'), ((108543, 108604), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.MemberRepository.update"""'], {}), "('octavia.db.repositories.MemberRepository.update')\n", (108553, 108604), False, 'import mock\n'), ((110208, 110269), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.MemberRepository.update"""'], {}), "('octavia.db.repositories.MemberRepository.update')\n", (110218, 110269), False, 'import mock\n'), ((111873, 111932), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.PoolRepository.update"""'], {}), "('octavia.db.repositories.PoolRepository.update')\n", (111883, 111932), False, 'import mock\n'), ((113303, 113362), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.PoolRepository.update"""'], {}), "('octavia.db.repositories.PoolRepository.update')\n", (113313, 113362), False, 'import mock\n'), ((114852, 114911), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.PoolRepository.update"""'], {}), "('octavia.db.repositories.PoolRepository.update')\n", (114862, 114911), False, 'import mock\n'), ((116401, 116460), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.PoolRepository.update"""'], {}), "('octavia.db.repositories.PoolRepository.update')\n", (116411, 116460), False, 'import mock\n'), ((117987, 118061), 'mock.patch', 'mock.patch', (['"""octavia.db.repositories.MemberRepository.update_pool_members"""'], {}), "('octavia.db.repositories.MemberRepository.update_pool_members')\n", (117997, 118061), False, 'import mock\n'), ((3716, 3732), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (3730, 3732), False, 'import mock\n'), ((3850, 3866), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (3864, 3866), False, 'import mock\n'), ((3945, 3961), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (3959, 3961), False, 'import mock\n'), ((4032, 4048), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (4046, 4048), False, 'import mock\n'), ((4118, 4134), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (4132, 4134), False, 'import mock\n'), ((4392, 4408), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (4406, 4408), False, 'import mock\n'), ((4481, 4497), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (4495, 4497), False, 'import mock\n'), ((5266, 5300), 'octavia.controller.worker.v2.tasks.database_tasks.CreateAmphoraInDB', 'database_tasks.CreateAmphoraInDB', ([], {}), '()\n', (5298, 5300), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((5354, 5480), 'octavia.db.repositories.AmphoraRepository.create.assert_called_once_with', 'repo.AmphoraRepository.create.assert_called_once_with', (['"""TEST"""'], {'id': 'AMP_ID', 'status': 'constants.PENDING_CREATE', 'cert_busy': '(False)'}), "('TEST', id=AMP_ID,\n    status=constants.PENDING_CREATE, cert_busy=False)\n", (5407, 5480), True, 'from octavia.db import repositories as repo\n'), ((6919, 6954), 'octavia.controller.worker.v2.tasks.database_tasks.DeleteListenerInDB', 'database_tasks.DeleteListenerInDB', ([], {}), '()\n', (6952, 6954), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((7034, 7112), 'octavia.db.repositories.ListenerRepository.delete.assert_called_once_with', 'repo.ListenerRepository.delete.assert_called_once_with', (['"""TEST"""'], {'id': 'LISTENER_ID'}), "('TEST', id=LISTENER_ID)\n", (7088, 7112), True, 'from octavia.db import repositories as repo\n'), ((7173, 7216), 'octavia.db.repositories.ListenerRepository.delete.reset_mock', 'repo.ListenerRepository.delete.reset_mock', ([], {}), '()\n', (7214, 7216), True, 'from octavia.db import repositories as repo\n'), ((7294, 7344), 'octavia.db.repositories.ListenerRepository.delete.assert_not_called', 'repo.ListenerRepository.delete.assert_not_called', ([], {}), '()\n', (7342, 7344), True, 'from octavia.db import repositories as repo\n'), ((8156, 8196), 'octavia.controller.worker.v2.tasks.database_tasks.DeleteHealthMonitorInDB', 'database_tasks.DeleteHealthMonitorInDB', ([], {}), '()\n', (8194, 8196), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((8262, 8339), 'octavia.db.repositories.HealthMonitorRepository.delete.assert_called_once_with', 'repo.HealthMonitorRepository.delete.assert_called_once_with', (['"""TEST"""'], {'id': 'HM_ID'}), "('TEST', id=HM_ID)\n", (8321, 8339), True, 'from octavia.db import repositories as repo\n'), ((8493, 8612), 'octavia.db.repositories.HealthMonitorRepository.update.assert_called_once_with', 'repo.HealthMonitorRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'HM_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=\n    HM_ID, provisioning_status=constants.ERROR)\n", (8552, 8612), True, 'from octavia.db import repositories as repo\n'), ((8843, 8920), 'octavia.db.repositories.HealthMonitorRepository.delete.assert_called_once_with', 'repo.HealthMonitorRepository.delete.assert_called_once_with', (['"""TEST"""'], {'id': 'HM_ID'}), "('TEST', id=HM_ID)\n", (8902, 8920), True, 'from octavia.db import repositories as repo\n'), ((9825, 9871), 'octavia.controller.worker.v2.tasks.database_tasks.DeleteHealthMonitorInDBByPool', 'database_tasks.DeleteHealthMonitorInDBByPool', ([], {}), '()\n', (9869, 9871), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((9934, 10011), 'octavia.db.repositories.HealthMonitorRepository.delete.assert_called_once_with', 'repo.HealthMonitorRepository.delete.assert_called_once_with', (['"""TEST"""'], {'id': 'HM_ID'}), "('TEST', id=HM_ID)\n", (9993, 10011), True, 'from octavia.db import repositories as repo\n'), ((10174, 10293), 'octavia.db.repositories.HealthMonitorRepository.update.assert_called_once_with', 'repo.HealthMonitorRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'HM_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=\n    HM_ID, provisioning_status=constants.ERROR)\n", (10233, 10293), True, 'from octavia.db import repositories as repo\n'), ((11097, 11130), 'octavia.controller.worker.v2.tasks.database_tasks.DeleteMemberInDB', 'database_tasks.DeleteMemberInDB', ([], {}), '()\n', (11128, 11130), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((11188, 11262), 'octavia.db.repositories.MemberRepository.delete.assert_called_once_with', 'repo.MemberRepository.delete.assert_called_once_with', (['"""TEST"""'], {'id': 'MEMBER_ID'}), "('TEST', id=MEMBER_ID)\n", (11240, 11262), True, 'from octavia.db import repositories as repo\n'), ((12093, 12124), 'octavia.controller.worker.v2.tasks.database_tasks.DeletePoolInDB', 'database_tasks.DeletePoolInDB', ([], {}), '()\n', (12122, 12124), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((12171, 12241), 'octavia.db.repositories.PoolRepository.delete.assert_called_once_with', 'repo.PoolRepository.delete.assert_called_once_with', (['"""TEST"""'], {'id': 'POOL_ID'}), "('TEST', id=POOL_ID)\n", (12221, 12241), True, 'from octavia.db import repositories as repo\n'), ((13150, 13185), 'octavia.controller.worker.v2.tasks.database_tasks.DeleteL7PolicyInDB', 'database_tasks.DeleteL7PolicyInDB', ([], {}), '()\n', (13183, 13185), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((13243, 13321), 'octavia.db.repositories.L7PolicyRepository.delete.assert_called_once_with', 'repo.L7PolicyRepository.delete.assert_called_once_with', (['"""TEST"""'], {'id': 'L7POLICY_ID'}), "('TEST', id=L7POLICY_ID)\n", (13297, 13321), True, 'from octavia.db import repositories as repo\n'), ((14231, 14264), 'octavia.controller.worker.v2.tasks.database_tasks.DeleteL7RuleInDB', 'database_tasks.DeleteL7RuleInDB', ([], {}), '()\n', (14262, 14264), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((14318, 14392), 'octavia.db.repositories.L7RuleRepository.delete.assert_called_once_with', 'repo.L7RuleRepository.delete.assert_called_once_with', (['"""TEST"""'], {'id': 'L7RULE_ID'}), "('TEST', id=L7RULE_ID)\n", (14370, 14392), True, 'from octavia.db import repositories as repo\n'), ((15279, 15309), 'octavia.controller.worker.v2.tasks.database_tasks.ReloadAmphora', 'database_tasks.ReloadAmphora', ([], {}), '()\n', (15307, 15309), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((15360, 15429), 'octavia.db.repositories.AmphoraRepository.get.assert_called_once_with', 'repo.AmphoraRepository.get.assert_called_once_with', (['"""TEST"""'], {'id': 'AMP_ID'}), "('TEST', id=AMP_ID)\n", (15410, 15429), True, 'from octavia.db import repositories as repo\n'), ((16126, 16161), 'octavia.controller.worker.v2.tasks.database_tasks.ReloadLoadBalancer', 'database_tasks.ReloadLoadBalancer', ([], {}), '()\n', (16159, 16161), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((16209, 16282), 'octavia.db.repositories.LoadBalancerRepository.get.assert_called_once_with', 'repo.LoadBalancerRepository.get.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID'}), "('TEST', id=LB_ID)\n", (16264, 16282), True, 'from octavia.db import repositories as repo\n'), ((17179, 17220), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateVIPAfterAllocation', 'database_tasks.UpdateVIPAfterAllocation', ([], {}), '()\n', (17218, 17220), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((18272, 18310), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateAmphoraeVIPData', 'database_tasks.UpdateAmphoraeVIPData', ([], {}), '()\n', (18308, 18310), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((19109, 19146), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateAmphoraVIPData', 'database_tasks.UpdateAmphoraVIPData', ([], {}), '()\n', (19144, 19146), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((19975, 20016), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateAmpFailoverDetails', 'database_tasks.UpdateAmpFailoverDetails', ([], {}), '()\n', (20014, 20016), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((20784, 20833), 'octavia.controller.worker.v2.tasks.database_tasks.AssociateFailoverAmphoraWithLBID', 'database_tasks.AssociateFailoverAmphoraWithLBID', ([], {}), '()\n', (20831, 20833), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((22497, 22538), 'octavia.controller.worker.v2.tasks.database_tasks.MapLoadbalancerToAmphora', 'database_tasks.MapLoadbalancerToAmphora', ([], {}), '()\n', (22536, 22538), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((22614, 22708), 'octavia.db.repositories.AmphoraRepository.allocate_and_associate.assert_called_once_with', 'repo.AmphoraRepository.allocate_and_associate.assert_called_once_with', (['"""TEST"""', 'LB_ID', 'None'], {}), "('TEST',\n    LB_ID, None)\n", (22683, 22708), True, 'from octavia.db import repositories as repo\n'), ((22989, 23106), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (23047, 23106), True, 'from octavia.db import repositories as repo\n'), ((23186, 23233), 'octavia.db.repositories.LoadBalancerRepository.update.reset_mock', 'repo.LoadBalancerRepository.update.reset_mock', ([], {}), '()\n', (23231, 23233), True, 'from octavia.db import repositories as repo\n'), ((23374, 23491), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (23432, 23491), True, 'from octavia.db import repositories as repo\n'), ((24340, 24381), 'octavia.controller.worker.v2.tasks.database_tasks.MapLoadbalancerToAmphora', 'database_tasks.MapLoadbalancerToAmphora', ([], {}), '()\n', (24379, 24381), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((24541, 24639), 'octavia.db.repositories.AmphoraRepository.allocate_and_associate.assert_called_once_with', 'repo.AmphoraRepository.allocate_and_associate.assert_called_once_with', (['"""TEST"""', 'LB_ID', '"""fakeaz"""'], {}), "('TEST',\n    LB_ID, 'fakeaz')\n", (24610, 24639), True, 'from octavia.db import repositories as repo\n'), ((24920, 25037), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (24978, 25037), True, 'from octavia.db import repositories as repo\n'), ((25117, 25164), 'octavia.db.repositories.LoadBalancerRepository.update.reset_mock', 'repo.LoadBalancerRepository.update.reset_mock', ([], {}), '()\n', (25162, 25164), True, 'from octavia.db import repositories as repo\n'), ((25305, 25422), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (25363, 25422), True, 'from octavia.db import repositories as repo\n'), ((26376, 26418), 'octavia.controller.worker.v2.tasks.database_tasks.MarkLBAmphoraeDeletedInDB', 'database_tasks.MarkLBAmphoraeDeletedInDB', ([], {}), '()\n', (26416, 26418), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((26523, 26625), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'AMP_ID', 'status': 'constants.DELETED'}), "('TEST', id=AMP_ID,\n    status=constants.DELETED)\n", (26576, 26625), True, 'from octavia.db import repositories as repo\n'), ((27561, 27602), 'octavia.controller.worker.v2.tasks.database_tasks.MarkAmphoraAllocatedInDB', 'database_tasks.MarkAmphoraAllocatedInDB', ([], {}), '()\n', (27600, 27602), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((27774, 27959), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'status': 'constants.AMPHORA_ALLOCATED', 'compute_id': 'COMPUTE_ID', 'lb_network_ip': 'LB_NET_IP', 'load_balancer_id': 'LB_ID'}), "('TEST', AMP_ID,\n    status=constants.AMPHORA_ALLOCATED, compute_id=COMPUTE_ID,\n    lb_network_ip=LB_NET_IP, load_balancer_id=LB_ID)\n", (27827, 27959), True, 'from octavia.db import repositories as repo\n'), ((28236, 28336), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'AMP_ID', 'status': 'constants.ERROR'}), "('TEST', id=AMP_ID,\n    status=constants.ERROR)\n", (28289, 28336), True, 'from octavia.db import repositories as repo\n'), ((28661, 28761), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'AMP_ID', 'status': 'constants.ERROR'}), "('TEST', id=AMP_ID,\n    status=constants.ERROR)\n", (28714, 28761), True, 'from octavia.db import repositories as repo\n'), ((29315, 29354), 'octavia.controller.worker.v2.tasks.database_tasks.MarkAmphoraBootingInDB', 'database_tasks.MarkAmphoraBootingInDB', ([], {}), '()\n', (29352, 29354), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((29486, 29616), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'status': 'constants.AMPHORA_BOOTING', 'compute_id': 'COMPUTE_ID'}), "('TEST', AMP_ID,\n    status=constants.AMPHORA_BOOTING, compute_id=COMPUTE_ID)\n", (29539, 29616), True, 'from octavia.db import repositories as repo\n'), ((29871, 29991), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'status': 'constants.ERROR', 'compute_id': 'COMPUTE_ID'}), "('TEST', AMP_ID,\n    status=constants.ERROR, compute_id=COMPUTE_ID)\n", (29924, 29991), True, 'from octavia.db import repositories as repo\n'), ((30326, 30446), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'status': 'constants.ERROR', 'compute_id': 'COMPUTE_ID'}), "('TEST', AMP_ID,\n    status=constants.ERROR, compute_id=COMPUTE_ID)\n", (30379, 30446), True, 'from octavia.db import repositories as repo\n'), ((31012, 31051), 'octavia.controller.worker.v2.tasks.database_tasks.MarkAmphoraDeletedInDB', 'database_tasks.MarkAmphoraDeletedInDB', ([], {}), '()\n', (31049, 31051), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((31115, 31214), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'status': 'constants.DELETED'}), "('TEST', AMP_ID,\n    status=constants.DELETED)\n", (31168, 31214), True, 'from octavia.db import repositories as repo\n'), ((31383, 31483), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'AMP_ID', 'status': 'constants.ERROR'}), "('TEST', id=AMP_ID,\n    status=constants.ERROR)\n", (31436, 31483), True, 'from octavia.db import repositories as repo\n'), ((31732, 31832), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'AMP_ID', 'status': 'constants.ERROR'}), "('TEST', id=AMP_ID,\n    status=constants.ERROR)\n", (31785, 31832), True, 'from octavia.db import repositories as repo\n'), ((32450, 32495), 'octavia.controller.worker.v2.tasks.database_tasks.MarkAmphoraPendingDeleteInDB', 'database_tasks.MarkAmphoraPendingDeleteInDB', ([], {}), '()\n', (32493, 32495), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((32609, 32715), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'status': 'constants.PENDING_DELETE'}), "('TEST', AMP_ID,\n    status=constants.PENDING_DELETE)\n", (32662, 32715), True, 'from octavia.db import repositories as repo\n'), ((32891, 32991), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'AMP_ID', 'status': 'constants.ERROR'}), "('TEST', id=AMP_ID,\n    status=constants.ERROR)\n", (32944, 32991), True, 'from octavia.db import repositories as repo\n'), ((33248, 33348), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'AMP_ID', 'status': 'constants.ERROR'}), "('TEST', id=AMP_ID,\n    status=constants.ERROR)\n", (33301, 33348), True, 'from octavia.db import repositories as repo\n'), ((33966, 34011), 'octavia.controller.worker.v2.tasks.database_tasks.MarkAmphoraPendingUpdateInDB', 'database_tasks.MarkAmphoraPendingUpdateInDB', ([], {}), '()\n', (34009, 34011), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((34125, 34231), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'status': 'constants.PENDING_UPDATE'}), "('TEST', AMP_ID,\n    status=constants.PENDING_UPDATE)\n", (34178, 34231), True, 'from octavia.db import repositories as repo\n'), ((34407, 34507), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'AMP_ID', 'status': 'constants.ERROR'}), "('TEST', id=AMP_ID,\n    status=constants.ERROR)\n", (34460, 34507), True, 'from octavia.db import repositories as repo\n'), ((34763, 34863), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'AMP_ID', 'status': 'constants.ERROR'}), "('TEST', id=AMP_ID,\n    status=constants.ERROR)\n", (34816, 34863), True, 'from octavia.db import repositories as repo\n'), ((35448, 35485), 'octavia.controller.worker.v2.tasks.database_tasks.MarkAmphoraReadyInDB', 'database_tasks.MarkAmphoraReadyInDB', ([], {}), '()\n', (35483, 35485), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((35547, 35705), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'status': 'constants.AMPHORA_READY', 'compute_id': 'COMPUTE_ID', 'lb_network_ip': 'LB_NET_IP'}), "('TEST', AMP_ID,\n    status=constants.AMPHORA_READY, compute_id=COMPUTE_ID, lb_network_ip=\n    LB_NET_IP)\n", (35600, 35705), True, 'from octavia.db import repositories as repo\n'), ((35892, 36037), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'status': 'constants.ERROR', 'compute_id': 'COMPUTE_ID', 'lb_network_ip': 'LB_NET_IP'}), "('TEST', AMP_ID,\n    status=constants.ERROR, compute_id=COMPUTE_ID, lb_network_ip=LB_NET_IP)\n", (35945, 36037), True, 'from octavia.db import repositories as repo\n'), ((36309, 36454), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'status': 'constants.ERROR', 'compute_id': 'COMPUTE_ID', 'lb_network_ip': 'LB_NET_IP'}), "('TEST', AMP_ID,\n    status=constants.ERROR, compute_id=COMPUTE_ID, lb_network_ip=LB_NET_IP)\n", (36362, 36454), True, 'from octavia.db import repositories as repo\n'), ((37094, 37128), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateAmphoraInfo', 'database_tasks.UpdateAmphoraInfo', ([], {}), '()\n', (37126, 37128), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((37197, 37374), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'lb_network_ip': 'LB_NET_IP', 'cached_zone': 'CACHED_ZONE', 'image_id': 'IMAGE_ID', 'compute_flavor': 'COMPUTE_FLAVOR'}), "('TEST', AMP_ID,\n    lb_network_ip=LB_NET_IP, cached_zone=CACHED_ZONE, image_id=IMAGE_ID,\n    compute_flavor=COMPUTE_FLAVOR)\n", (37250, 37374), True, 'from octavia.db import repositories as repo\n'), ((37449, 37518), 'octavia.db.repositories.AmphoraRepository.get.assert_called_once_with', 'repo.AmphoraRepository.get.assert_called_once_with', (['"""TEST"""'], {'id': 'AMP_ID'}), "('TEST', id=AMP_ID)\n", (37499, 37518), True, 'from octavia.db import repositories as repo\n'), ((38071, 38111), 'octavia.controller.worker.v2.tasks.database_tasks.MarkListenerDeletedInDB', 'database_tasks.MarkListenerDeletedInDB', ([], {}), '()\n', (38109, 38111), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((38179, 38297), 'octavia.db.repositories.ListenerRepository.update.assert_called_once_with', 'repo.ListenerRepository.update.assert_called_once_with', (['"""TEST"""', 'LISTENER_ID'], {'provisioning_status': 'constants.DELETED'}), "('TEST', LISTENER_ID,\n    provisioning_status=constants.DELETED)\n", (38233, 38297), True, 'from octavia.db import repositories as repo\n'), ((38471, 38591), 'octavia.db.repositories.ListenerRepository.update.assert_called_once_with', 'repo.ListenerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LISTENER_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=\n    LISTENER_ID, provisioning_status=constants.ERROR)\n", (38525, 38591), True, 'from octavia.db import repositories as repo\n'), ((38845, 38965), 'octavia.db.repositories.ListenerRepository.update.assert_called_once_with', 'repo.ListenerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LISTENER_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=\n    LISTENER_ID, provisioning_status=constants.ERROR)\n", (38899, 38965), True, 'from octavia.db import repositories as repo\n'), ((39597, 39643), 'octavia.controller.worker.v2.tasks.database_tasks.MarkListenerPendingDeleteInDB', 'database_tasks.MarkListenerPendingDeleteInDB', ([], {}), '()\n', (39641, 39643), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((39760, 39885), 'octavia.db.repositories.ListenerRepository.update.assert_called_once_with', 'repo.ListenerRepository.update.assert_called_once_with', (['"""TEST"""', 'LISTENER_ID'], {'provisioning_status': 'constants.PENDING_DELETE'}), "('TEST', LISTENER_ID,\n    provisioning_status=constants.PENDING_DELETE)\n", (39814, 39885), True, 'from octavia.db import repositories as repo\n'), ((40066, 40186), 'octavia.db.repositories.ListenerRepository.update.assert_called_once_with', 'repo.ListenerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LISTENER_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=\n    LISTENER_ID, provisioning_status=constants.ERROR)\n", (40120, 40186), True, 'from octavia.db import repositories as repo\n'), ((40447, 40567), 'octavia.db.repositories.ListenerRepository.update.assert_called_once_with', 'repo.ListenerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LISTENER_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=\n    LISTENER_ID, provisioning_status=constants.ERROR)\n", (40501, 40567), True, 'from octavia.db import repositories as repo\n'), ((41493, 41538), 'octavia.controller.worker.v2.tasks.database_tasks.MarkLBAndListenersActiveInDB', 'database_tasks.MarkLBAndListenersActiveInDB', ([], {}), '()\n', (41536, 41538), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((41732, 41847), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""', 'LB_ID'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', LB_ID,\n    provisioning_status=constants.ACTIVE)\n", (41790, 41847), True, 'from octavia.db import repositories as repo\n'), ((42176, 42221), 'octavia.controller.worker.v2.tasks.database_tasks.MarkLBAndListenersActiveInDB', 'database_tasks.MarkLBAndListenersActiveInDB', ([], {}), '()\n', (42219, 42221), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((42414, 42529), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""', 'LB_ID'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', LB_ID,\n    provisioning_status=constants.ACTIVE)\n", (42472, 42529), True, 'from octavia.db import repositories as repo\n'), ((42960, 43080), 'octavia.db.repositories.ListenerRepository.update.assert_called_once_with', 'repo.ListenerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LISTENER_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=\n    LISTENER_ID, provisioning_status=constants.ERROR)\n", (43014, 43080), True, 'from octavia.db import repositories as repo\n'), ((43121, 43238), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (43179, 43238), True, 'from octavia.db import repositories as repo\n'), ((43495, 43615), 'octavia.db.repositories.ListenerRepository.update.assert_called_once_with', 'repo.ListenerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LISTENER_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=\n    LISTENER_ID, provisioning_status=constants.ERROR)\n", (43549, 43615), True, 'from octavia.db import repositories as repo\n'), ((43656, 43773), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (43714, 43773), True, 'from octavia.db import repositories as repo\n'), ((44464, 44584), 'octavia.db.repositories.ListenerRepository.update.assert_called_once_with', 'repo.ListenerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LISTENER_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=\n    LISTENER_ID, provisioning_status=constants.ERROR)\n", (44518, 44584), True, 'from octavia.db import repositories as repo\n'), ((44625, 44742), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (44683, 44742), True, 'from octavia.db import repositories as repo\n'), ((45465, 45511), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateAmphoraDBCertExpiration', 'database_tasks.UpdateAmphoraDBCertExpiration', ([], {}), '()\n', (45509, 45511), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((45526, 45580), 'octavia.common.utils.get_six_compatible_server_certs_key_passphrase', 'utils.get_six_compatible_server_certs_key_passphrase', ([], {}), '()\n', (45578, 45580), False, 'from octavia.common import utils\n'), ((45595, 45613), 'cryptography.fernet.Fernet', 'fernet.Fernet', (['key'], {}), '(key)\n', (45608, 45613), False, 'from cryptography import fernet\n'), ((45783, 45884), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'cert_expiration': '_cert_mock'}), "('TEST', AMP_ID,\n    cert_expiration=_cert_mock)\n", (45836, 45884), True, 'from octavia.db import repositories as repo\n'), ((46489, 46534), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateAmphoraCertBusyToFalse', 'database_tasks.UpdateAmphoraCertBusyToFalse', ([], {}), '()\n', (46532, 46534), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((46593, 46683), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'cert_busy': '(False)'}), "('TEST', AMP_ID,\n    cert_busy=False)\n", (46646, 46683), True, 'from octavia.db import repositories as repo\n'), ((47191, 47224), 'octavia.controller.worker.v2.tasks.database_tasks.MarkLBActiveInDB', 'database_tasks.MarkLBActiveInDB', ([], {}), '()\n', (47222, 47224), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((47299, 47414), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""', 'LB_ID'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', LB_ID,\n    provisioning_status=constants.ACTIVE)\n", (47357, 47414), True, 'from octavia.db import repositories as repo\n'), ((47670, 47787), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (47728, 47787), True, 'from octavia.db import repositories as repo\n'), ((48128, 48245), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (48186, 48245), True, 'from octavia.db import repositories as repo\n'), ((48971, 49014), 'octavia.controller.worker.v2.tasks.database_tasks.MarkLBActiveInDBByListener', 'database_tasks.MarkLBActiveInDBByListener', ([], {}), '()\n', (49012, 49014), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((49080, 49195), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""', 'LB_ID'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', LB_ID,\n    provisioning_status=constants.ACTIVE)\n", (49138, 49195), True, 'from octavia.db import repositories as repo\n'), ((49442, 49559), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (49500, 49559), True, 'from octavia.db import repositories as repo\n'), ((49891, 50008), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (49949, 50008), True, 'from octavia.db import repositories as repo\n'), ((50794, 50849), 'octavia.common.data_models.LoadBalancer', 'data_models.LoadBalancer', ([], {'id': 'LB_ID', 'listeners': 'listeners'}), '(id=LB_ID, listeners=listeners)\n', (50818, 50849), False, 'from octavia.common import data_models\n'), ((50875, 50928), 'octavia.controller.worker.v2.tasks.database_tasks.MarkLBActiveInDB', 'database_tasks.MarkLBActiveInDB', ([], {'mark_subobjects': '(True)'}), '(mark_subobjects=True)\n', (50906, 50928), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((50973, 51088), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""', 'lb.id'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', lb.id,\n    provisioning_status=constants.ACTIVE)\n", (51031, 51088), True, 'from octavia.db import repositories as repo\n'), ((51606, 51723), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'lb.id', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=lb.id,\n    provisioning_status=constants.ERROR)\n", (51664, 51723), True, 'from octavia.db import repositories as repo\n'), ((53325, 53359), 'octavia.common.data_models.Pool', 'data_models.Pool', ([], {'id': '"""unused_pool"""'}), "(id='unused_pool')\n", (53341, 53359), False, 'from octavia.common import data_models\n'), ((53493, 53528), 'octavia.common.data_models.HealthMonitor', 'data_models.HealthMonitor', ([], {'id': '"""hm1"""'}), "(id='hm1')\n", (53518, 53528), False, 'from octavia.common import data_models\n'), ((53552, 53641), 'octavia.common.data_models.Pool', 'data_models.Pool', ([], {'id': '"""default_pool"""', 'members': 'members1', 'health_monitor': 'health_monitor'}), "(id='default_pool', members=members1, health_monitor=\n    health_monitor)\n", (53568, 53641), False, 'from octavia.common import data_models\n'), ((53737, 53800), 'octavia.common.data_models.Listener', 'data_models.Listener', ([], {'id': '"""listener1"""', 'default_pool': 'default_pool'}), "(id='listener1', default_pool=default_pool)\n", (53757, 53800), False, 'from octavia.common import data_models\n'), ((53974, 54028), 'octavia.common.data_models.Pool', 'data_models.Pool', ([], {'id': '"""redirect_pool"""', 'members': 'members2'}), "(id='redirect_pool', members=members2)\n", (53990, 54028), False, 'from octavia.common import data_models\n'), ((54147, 54239), 'octavia.common.data_models.L7Policy', 'data_models.L7Policy', ([], {'id': '"""redirect_policy"""', 'redirect_pool': 'redirect_pool', 'l7rules': 'l7rules'}), "(id='redirect_policy', redirect_pool=redirect_pool,\n    l7rules=l7rules)\n", (54167, 54239), False, 'from octavia.common import data_models\n'), ((54389, 54448), 'octavia.common.data_models.Listener', 'data_models.Listener', ([], {'id': '"""listener2"""', 'l7policies': 'l7policies'}), "(id='listener2', l7policies=l7policies)\n", (54409, 54448), False, 'from octavia.common import data_models\n'), ((54648, 54716), 'octavia.common.data_models.LoadBalancer', 'data_models.LoadBalancer', ([], {'id': 'LB_ID', 'listeners': 'listeners', 'pools': 'pools'}), '(id=LB_ID, listeners=listeners, pools=pools)\n', (54672, 54716), False, 'from octavia.common import data_models\n'), ((54780, 54833), 'octavia.controller.worker.v2.tasks.database_tasks.MarkLBActiveInDB', 'database_tasks.MarkLBActiveInDB', ([], {'mark_subobjects': '(True)'}), '(mark_subobjects=True)\n', (54811, 54833), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((54878, 54993), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""', 'lb.id'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', lb.id,\n    provisioning_status=constants.ACTIVE)\n", (54936, 54993), True, 'from octavia.db import repositories as repo\n'), ((56762, 56879), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'lb.id', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=lb.id,\n    provisioning_status=constants.ERROR)\n", (56820, 56879), True, 'from octavia.db import repositories as repo\n'), ((58769, 58803), 'octavia.controller.worker.v2.tasks.database_tasks.MarkLBDeletedInDB', 'database_tasks.MarkLBDeletedInDB', ([], {}), '()\n', (58801, 58803), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((58879, 58995), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""', 'LB_ID'], {'provisioning_status': 'constants.DELETED'}), "('TEST', LB_ID,\n    provisioning_status=constants.DELETED)\n", (58937, 58995), True, 'from octavia.db import repositories as repo\n'), ((59181, 59298), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (59239, 59298), True, 'from octavia.db import repositories as repo\n'), ((59569, 59686), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (59627, 59686), True, 'from octavia.db import repositories as repo\n'), ((60275, 60315), 'octavia.controller.worker.v2.tasks.database_tasks.MarkLBPendingDeleteInDB', 'database_tasks.MarkLBPendingDeleteInDB', ([], {}), '()\n', (60313, 60315), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((60444, 60567), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""', 'LB_ID'], {'provisioning_status': 'constants.PENDING_DELETE'}), "('TEST', LB_ID,\n    provisioning_status=constants.PENDING_DELETE)\n", (60502, 60567), True, 'from octavia.db import repositories as repo\n'), ((60760, 60877), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (60818, 60877), True, 'from octavia.db import repositories as repo\n'), ((61155, 61272), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (61213, 61272), True, 'from octavia.db import repositories as repo\n'), ((61973, 62009), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateHealthMonInDB', 'database_tasks.UpdateHealthMonInDB', ([], {}), '()\n', (62007, 62009), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((62137, 62235), 'octavia.db.repositories.HealthMonitorRepository.update.assert_called_once_with', 'repo.HealthMonitorRepository.update.assert_called_once_with', (['"""TEST"""', 'HM_ID'], {'delay': '(1)', 'timeout': '(2)'}), "('TEST', HM_ID,\n    delay=1, timeout=2)\n", (62196, 62235), True, 'from octavia.db import repositories as repo\n'), ((62409, 62524), 'octavia.db.repositories.HealthMonitorRepository.update.assert_called_once_with', 'repo.HealthMonitorRepository.update.assert_called_once_with', (['"""TEST"""', 'HM_ID'], {'provisioning_status': 'constants.ERROR'}), "('TEST', HM_ID,\n    provisioning_status=constants.ERROR)\n", (62468, 62524), True, 'from octavia.db import repositories as repo\n'), ((62781, 62896), 'octavia.db.repositories.HealthMonitorRepository.update.assert_called_once_with', 'repo.HealthMonitorRepository.update.assert_called_once_with', (['"""TEST"""', 'HM_ID'], {'provisioning_status': 'constants.ERROR'}), "('TEST', HM_ID,\n    provisioning_status=constants.ERROR)\n", (62840, 62896), True, 'from octavia.db import repositories as repo\n'), ((63448, 63487), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateLoadbalancerInDB', 'database_tasks.UpdateLoadbalancerInDB', ([], {}), '()\n', (63485, 63487), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((63637, 63748), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""', 'LB_ID'], {'name': '"""test"""', 'description': '"""test2"""'}), "('TEST', LB_ID,\n    name='test', description='test2')\n", (63695, 63748), True, 'from octavia.db import repositories as repo\n'), ((63929, 64046), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (63987, 64046), True, 'from octavia.db import repositories as repo\n'), ((64312, 64429), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=LB_ID,\n    provisioning_status=constants.ERROR)\n", (64370, 64429), True, 'from octavia.db import repositories as repo\n'), ((65285, 65324), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateLoadbalancerInDB', 'database_tasks.UpdateLoadbalancerInDB', ([], {}), '()\n', (65322, 65324), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((65584, 65695), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""', 'LB_ID'], {'name': '"""test"""', 'description': '"""test2"""'}), "('TEST', LB_ID,\n    name='test', description='test2')\n", (65642, 65695), True, 'from octavia.db import repositories as repo\n'), ((65738, 65828), 'octavia.db.repositories.VipRepository.update.assert_called_once_with', 'repo.VipRepository.update.assert_called_once_with', (['"""TEST"""', 'LB_ID'], {'qos_policy_id': '"""fool"""'}), "('TEST', LB_ID,\n    qos_policy_id='fool')\n", (65787, 65828), True, 'from octavia.db import repositories as repo\n'), ((66356, 66391), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateListenerInDB', 'database_tasks.UpdateListenerInDB', ([], {}), '()\n', (66389, 66391), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((66583, 66696), 'octavia.db.repositories.ListenerRepository.update.assert_called_once_with', 'repo.ListenerRepository.update.assert_called_once_with', (['"""TEST"""', 'LISTENER_ID'], {'name': '"""test"""', 'description': '"""test2"""'}), "('TEST', LISTENER_ID,\n    name='test', description='test2')\n", (66637, 66696), True, 'from octavia.db import repositories as repo\n'), ((66858, 66978), 'octavia.db.repositories.ListenerRepository.update.assert_called_once_with', 'repo.ListenerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LISTENER_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=\n    LISTENER_ID, provisioning_status=constants.ERROR)\n", (66912, 66978), True, 'from octavia.db import repositories as repo\n'), ((67205, 67325), 'octavia.db.repositories.ListenerRepository.update.assert_called_once_with', 'repo.ListenerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LISTENER_ID', 'provisioning_status': 'constants.ERROR'}), "('TEST', id=\n    LISTENER_ID, provisioning_status=constants.ERROR)\n", (67259, 67325), True, 'from octavia.db import repositories as repo\n'), ((67938, 67971), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateMemberInDB', 'database_tasks.UpdateMemberInDB', ([], {}), '()\n', (67969, 67971), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((68100, 68208), 'octavia.db.repositories.MemberRepository.update.assert_called_once_with', 'repo.MemberRepository.update.assert_called_once_with', (['"""TEST"""', 'MEMBER_ID'], {'weight': '(1)', 'ip_address': '"""10.1.0.0"""'}), "('TEST', MEMBER_ID,\n    weight=1, ip_address='10.1.0.0')\n", (68152, 68208), True, 'from octavia.db import repositories as repo\n'), ((68370, 68482), 'octavia.db.repositories.MemberRepository.update.assert_called_once_with', 'repo.MemberRepository.update.assert_called_once_with', (['"""TEST"""', 'MEMBER_ID'], {'provisioning_status': 'constants.ERROR'}), "('TEST', MEMBER_ID,\n    provisioning_status=constants.ERROR)\n", (68422, 68482), True, 'from octavia.db import repositories as repo\n'), ((68708, 68820), 'octavia.db.repositories.MemberRepository.update.assert_called_once_with', 'repo.MemberRepository.update.assert_called_once_with', (['"""TEST"""', 'MEMBER_ID'], {'provisioning_status': 'constants.ERROR'}), "('TEST', MEMBER_ID,\n    provisioning_status=constants.ERROR)\n", (68760, 68820), True, 'from octavia.db import repositories as repo\n'), ((69609, 69640), 'octavia.controller.worker.v2.tasks.database_tasks.UpdatePoolInDB', 'database_tasks.UpdatePoolInDB', ([], {}), '()\n', (69638, 69640), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((69728, 69822), 'octavia.db.repositories.Repositories.update_pool_and_sp.assert_called_once_with', 'repo.Repositories.update_pool_and_sp.assert_called_once_with', (['"""TEST"""', 'POOL_ID', 'update_dict'], {}), "('TEST',\n    POOL_ID, update_dict)\n", (69788, 69822), True, 'from octavia.db import repositories as repo\n'), ((69972, 70095), 'octavia.db.repositories.Repositories.update_pool_and_sp.assert_called_once_with', 'repo.Repositories.update_pool_and_sp.assert_called_once_with', (['"""TEST"""', 'POOL_ID', "{'provisioning_status': constants.ERROR}"], {}), "('TEST',\n    POOL_ID, {'provisioning_status': constants.ERROR})\n", (70032, 70095), True, 'from octavia.db import repositories as repo\n'), ((70323, 70446), 'octavia.db.repositories.Repositories.update_pool_and_sp.assert_called_once_with', 'repo.Repositories.update_pool_and_sp.assert_called_once_with', (['"""TEST"""', 'POOL_ID', "{'provisioning_status': constants.ERROR}"], {}), "('TEST',\n    POOL_ID, {'provisioning_status': constants.ERROR})\n", (70383, 70446), True, 'from octavia.db import repositories as repo\n'), ((71084, 71119), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateL7PolicyInDB', 'database_tasks.UpdateL7PolicyInDB', ([], {}), '()\n', (71117, 71119), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((71259, 71379), 'octavia.db.repositories.L7PolicyRepository.update.assert_called_once_with', 'repo.L7PolicyRepository.update.assert_called_once_with', (['"""TEST"""', 'L7POLICY_ID'], {'action': 'constants.L7POLICY_ACTION_REJECT'}), "('TEST', L7POLICY_ID,\n    action=constants.L7POLICY_ACTION_REJECT)\n", (71313, 71379), True, 'from octavia.db import repositories as repo\n'), ((71547, 71663), 'octavia.db.repositories.L7PolicyRepository.update.assert_called_once_with', 'repo.L7PolicyRepository.update.assert_called_once_with', (['"""TEST"""', 'L7POLICY_ID'], {'provisioning_status': 'constants.ERROR'}), "('TEST', L7POLICY_ID,\n    provisioning_status=constants.ERROR)\n", (71601, 71663), True, 'from octavia.db import repositories as repo\n'), ((71897, 72013), 'octavia.db.repositories.L7PolicyRepository.update.assert_called_once_with', 'repo.L7PolicyRepository.update.assert_called_once_with', (['"""TEST"""', 'L7POLICY_ID'], {'provisioning_status': 'constants.ERROR'}), "('TEST', L7POLICY_ID,\n    provisioning_status=constants.ERROR)\n", (71951, 72013), True, 'from octavia.db import repositories as repo\n'), ((72756, 72789), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateL7RuleInDB', 'database_tasks.UpdateL7RuleInDB', ([], {}), '()\n', (72787, 72789), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((73012, 73195), 'octavia.db.repositories.L7RuleRepository.update.assert_called_once_with', 'repo.L7RuleRepository.update.assert_called_once_with', (['"""TEST"""', 'L7RULE_ID'], {'type': 'constants.L7RULE_TYPE_PATH', 'compare_type': 'constants.L7RULE_COMPARE_TYPE_STARTS_WITH', 'value': '"""/api"""'}), "('TEST', L7RULE_ID,\n    type=constants.L7RULE_TYPE_PATH, compare_type=constants.\n    L7RULE_COMPARE_TYPE_STARTS_WITH, value='/api')\n", (73064, 73195), True, 'from octavia.db import repositories as repo\n'), ((73376, 73492), 'octavia.db.repositories.L7PolicyRepository.update.assert_called_once_with', 'repo.L7PolicyRepository.update.assert_called_once_with', (['"""TEST"""', 'L7POLICY_ID'], {'provisioning_status': 'constants.ERROR'}), "('TEST', L7POLICY_ID,\n    provisioning_status=constants.ERROR)\n", (73430, 73492), True, 'from octavia.db import repositories as repo\n'), ((73718, 73834), 'octavia.db.repositories.L7PolicyRepository.update.assert_called_once_with', 'repo.L7PolicyRepository.update.assert_called_once_with', (['"""TEST"""', 'L7POLICY_ID'], {'provisioning_status': 'constants.ERROR'}), "('TEST', L7POLICY_ID,\n    provisioning_status=constants.ERROR)\n", (73772, 73834), True, 'from octavia.db import repositories as repo\n'), ((74325, 74359), 'octavia.controller.worker.v2.tasks.database_tasks.GetAmphoraDetails', 'database_tasks.GetAmphoraDetails', ([], {}), '()\n', (74357, 74359), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((75271, 75309), 'octavia.controller.worker.v2.tasks.database_tasks.MarkAmphoraMasterInDB', 'database_tasks.MarkAmphoraMasterInDB', ([], {}), '()\n', (75307, 75309), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((75370, 75505), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'role': '"""MASTER"""', 'vrrp_priority': 'constants.ROLE_MASTER_PRIORITY'}), "('TEST', AMP_ID, role=\n    'MASTER', vrrp_priority=constants.ROLE_MASTER_PRIORITY)\n", (75423, 75505), True, 'from octavia.db import repositories as repo\n'), ((75646, 75751), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'role': 'None', 'vrrp_priority': 'None'}), "('TEST', AMP_ID, role=\n    None, vrrp_priority=None)\n", (75699, 75751), True, 'from octavia.db import repositories as repo\n'), ((76092, 76130), 'octavia.controller.worker.v2.tasks.database_tasks.MarkAmphoraBackupInDB', 'database_tasks.MarkAmphoraBackupInDB', ([], {}), '()\n', (76128, 76130), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((76191, 76326), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'role': '"""BACKUP"""', 'vrrp_priority': 'constants.ROLE_BACKUP_PRIORITY'}), "('TEST', AMP_ID, role=\n    'BACKUP', vrrp_priority=constants.ROLE_BACKUP_PRIORITY)\n", (76244, 76326), True, 'from octavia.db import repositories as repo\n'), ((76467, 76572), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'role': 'None', 'vrrp_priority': 'None'}), "('TEST', AMP_ID, role=\n    None, vrrp_priority=None)\n", (76520, 76572), True, 'from octavia.db import repositories as repo\n'), ((76664, 76706), 'octavia.controller.worker.v2.tasks.database_tasks.MarkAmphoraStandAloneInDB', 'database_tasks.MarkAmphoraStandAloneInDB', ([], {}), '()\n', (76704, 76706), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((76771, 76884), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'role': '"""STANDALONE"""', 'vrrp_priority': 'None'}), "('TEST', AMP_ID, role=\n    'STANDALONE', vrrp_priority=None)\n", (76824, 76884), True, 'from octavia.db import repositories as repo\n'), ((77029, 77134), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'role': 'None', 'vrrp_priority': 'None'}), "('TEST', AMP_ID, role=\n    None, vrrp_priority=None)\n", (77082, 77134), True, 'from octavia.db import repositories as repo\n'), ((77368, 77473), 'octavia.db.repositories.AmphoraRepository.update.assert_called_once_with', 'repo.AmphoraRepository.update.assert_called_once_with', (['"""TEST"""', 'AMP_ID'], {'role': 'None', 'vrrp_priority': 'None'}), "('TEST', AMP_ID, role=\n    None, vrrp_priority=None)\n", (77421, 77473), True, 'from octavia.db import repositories as repo\n'), ((78142, 78158), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (78156, 78158), False, 'import mock\n'), ((78177, 78202), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (78200, 78202), False, 'from oslo_utils import uuidutils\n'), ((78218, 78234), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (78232, 78234), False, 'import mock\n'), ((78253, 78278), 'oslo_utils.uuidutils.generate_uuid', 'uuidutils.generate_uuid', ([], {}), '()\n', (78276, 78278), False, 'from oslo_utils import uuidutils\n'), ((78292, 78308), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (78306, 78308), False, 'import mock\n'), ((78438, 78482), 'octavia.controller.worker.v2.tasks.database_tasks.GetAmphoraeFromLoadbalancer', 'database_tasks.GetAmphoraeFromLoadbalancer', ([], {}), '()\n', (78480, 78482), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((79382, 79427), 'octavia.controller.worker.v2.tasks.database_tasks.GetListenersFromLoadbalancer', 'database_tasks.GetListenersFromLoadbalancer', ([], {}), '()\n', (79425, 79427), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((80198, 80237), 'octavia.controller.worker.v2.tasks.database_tasks.GetVipFromLoadbalancer', 'database_tasks.GetVipFromLoadbalancer', ([], {}), '()\n', (80235, 80237), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((81099, 81136), 'octavia.controller.worker.v2.tasks.database_tasks.CreateVRRPGroupForLB', 'database_tasks.CreateVRRPGroupForLB', ([], {}), '()\n', (81134, 81136), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((82349, 82396), 'octavia.controller.worker.v2.tasks.database_tasks.DisableAmphoraHealthMonitoring', 'database_tasks.DisableAmphoraHealthMonitoring', ([], {}), '()\n', (82394, 82396), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((83019, 83069), 'octavia.controller.worker.v2.tasks.database_tasks.DisableLBAmphoraeHealthMonitoring', 'database_tasks.DisableLBAmphoraeHealthMonitoring', ([], {}), '()\n', (83067, 83069), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((83956, 83994), 'octavia.controller.worker.v2.tasks.database_tasks.MarkAmphoraHealthBusy', 'database_tasks.MarkAmphoraHealthBusy', ([], {}), '()\n', (83992, 83994), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((84612, 84653), 'octavia.controller.worker.v2.tasks.database_tasks.MarkLBAmphoraeHealthBusy', 'database_tasks.MarkLBAmphoraeHealthBusy', ([], {}), '()\n', (84651, 84653), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((85350, 85390), 'octavia.controller.worker.v2.tasks.database_tasks.UpdateLBServerGroupInDB', 'database_tasks.UpdateLBServerGroupInDB', ([], {}), '()\n', (85388, 85390), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((85465, 85578), 'octavia.db.repositories.LoadBalancerRepository.update.assert_called_once_with', 'repo.LoadBalancerRepository.update.assert_called_once_with', (['"""TEST"""'], {'id': 'LB_ID', 'server_group_id': 'SERVER_GROUP_ID'}), "('TEST', id=LB_ID,\n    server_group_id=SERVER_GROUP_ID)\n", (85523, 85578), True, 'from octavia.db import repositories as repo\n'), ((86655, 86699), 'octavia.controller.worker.v2.tasks.database_tasks.MarkHealthMonitorActiveInDB', 'database_tasks.MarkHealthMonitorActiveInDB', ([], {}), '()\n', (86697, 86699), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((88092, 88143), 'octavia.controller.worker.v2.tasks.database_tasks.MarkHealthMonitorPendingCreateInDB', 'database_tasks.MarkHealthMonitorPendingCreateInDB', ([], {}), '()\n', (88141, 88143), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((89564, 89615), 'octavia.controller.worker.v2.tasks.database_tasks.MarkHealthMonitorPendingDeleteInDB', 'database_tasks.MarkHealthMonitorPendingDeleteInDB', ([], {}), '()\n', (89613, 89615), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((91036, 91087), 'octavia.controller.worker.v2.tasks.database_tasks.MarkHealthMonitorPendingUpdateInDB', 'database_tasks.MarkHealthMonitorPendingUpdateInDB', ([], {}), '()\n', (91085, 91087), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((92692, 92731), 'octavia.controller.worker.v2.tasks.database_tasks.MarkL7PolicyActiveInDB', 'database_tasks.MarkL7PolicyActiveInDB', ([], {}), '()\n', (92729, 92731), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((94382, 94428), 'octavia.controller.worker.v2.tasks.database_tasks.MarkL7PolicyPendingCreateInDB', 'database_tasks.MarkL7PolicyPendingCreateInDB', ([], {}), '()\n', (94426, 94428), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((96105, 96151), 'octavia.controller.worker.v2.tasks.database_tasks.MarkL7PolicyPendingDeleteInDB', 'database_tasks.MarkL7PolicyPendingDeleteInDB', ([], {}), '()\n', (96149, 96151), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((97828, 97874), 'octavia.controller.worker.v2.tasks.database_tasks.MarkL7PolicyPendingUpdateInDB', 'database_tasks.MarkL7PolicyPendingUpdateInDB', ([], {}), '()\n', (97872, 97874), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((99447, 99484), 'octavia.controller.worker.v2.tasks.database_tasks.MarkL7RuleActiveInDB', 'database_tasks.MarkL7RuleActiveInDB', ([], {}), '()\n', (99482, 99484), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((101081, 101125), 'octavia.controller.worker.v2.tasks.database_tasks.MarkL7RulePendingCreateInDB', 'database_tasks.MarkL7RulePendingCreateInDB', ([], {}), '()\n', (101123, 101125), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((102746, 102790), 'octavia.controller.worker.v2.tasks.database_tasks.MarkL7RulePendingDeleteInDB', 'database_tasks.MarkL7RulePendingDeleteInDB', ([], {}), '()\n', (102788, 102790), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((104411, 104455), 'octavia.controller.worker.v2.tasks.database_tasks.MarkL7RulePendingUpdateInDB', 'database_tasks.MarkL7RulePendingUpdateInDB', ([], {}), '()\n', (104453, 104455), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((105996, 106033), 'octavia.controller.worker.v2.tasks.database_tasks.MarkMemberActiveInDB', 'database_tasks.MarkMemberActiveInDB', ([], {}), '()\n', (106031, 106033), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((107583, 107627), 'octavia.controller.worker.v2.tasks.database_tasks.MarkMemberPendingCreateInDB', 'database_tasks.MarkMemberPendingCreateInDB', ([], {}), '()\n', (107625, 107627), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((109248, 109292), 'octavia.controller.worker.v2.tasks.database_tasks.MarkMemberPendingDeleteInDB', 'database_tasks.MarkMemberPendingDeleteInDB', ([], {}), '()\n', (109290, 109292), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((110913, 110957), 'octavia.controller.worker.v2.tasks.database_tasks.MarkMemberPendingUpdateInDB', 'database_tasks.MarkMemberPendingUpdateInDB', ([], {}), '()\n', (110955, 110957), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((112474, 112509), 'octavia.controller.worker.v2.tasks.database_tasks.MarkPoolActiveInDB', 'database_tasks.MarkPoolActiveInDB', ([], {}), '()\n', (112507, 112509), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((113984, 114026), 'octavia.controller.worker.v2.tasks.database_tasks.MarkPoolPendingCreateInDB', 'database_tasks.MarkPoolPendingCreateInDB', ([], {}), '()\n', (114024, 114026), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((115533, 115575), 'octavia.controller.worker.v2.tasks.database_tasks.MarkPoolPendingDeleteInDB', 'database_tasks.MarkPoolPendingDeleteInDB', ([], {}), '()\n', (115573, 115575), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((117082, 117124), 'octavia.controller.worker.v2.tasks.database_tasks.MarkPoolPendingUpdateInDB', 'database_tasks.MarkPoolPendingUpdateInDB', ([], {}), '()\n', (117122, 117124), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((118456, 118509), 'octavia.controller.worker.v2.tasks.database_tasks.UpdatePoolMembersOperatingStatusInDB', 'database_tasks.UpdatePoolMembersOperatingStatusInDB', ([], {}), '()\n', (118507, 118509), False, 'from octavia.controller.worker.v2.tasks import database_tasks\n'), ((8757, 8776), 'sqlalchemy.orm.exc.NoResultFound', 'exc.NoResultFound', ([], {}), '()\n', (8774, 8776), False, 'from sqlalchemy.orm import exc\n'), ((45659, 45702), 'octavia.common.utils.get_six_compatible_value', 'utils.get_six_compatible_value', (['"""test_cert"""'], {}), "('test_cert')\n", (45689, 45702), False, 'from octavia.common import utils\n'), ((50684, 50720), 'octavia.common.data_models.Listener', 'data_models.Listener', ([], {'id': '"""listener1"""'}), "(id='listener1')\n", (50704, 50720), False, 'from octavia.common import data_models\n'), ((50743, 50779), 'octavia.common.data_models.Listener', 'data_models.Listener', ([], {'id': '"""listener2"""'}), "(id='listener2')\n", (50763, 50779), False, 'from octavia.common import data_models\n'), ((54089, 54119), 'octavia.common.data_models.L7Rule', 'data_models.L7Rule', ([], {'id': '"""rule1"""'}), "(id='rule1')\n", (54107, 54119), False, 'from octavia.common import data_models\n'), ((51256, 51328), 'mock.call', 'mock.call', (['"""TEST"""', 'listeners[0].id'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', listeners[0].id, provisioning_status=constants.ACTIVE)\n", (51265, 51328), False, 'import mock\n'), ((51366, 51438), 'mock.call', 'mock.call', (['"""TEST"""', 'listeners[1].id'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', listeners[1].id, provisioning_status=constants.ACTIVE)\n", (51375, 51438), False, 'import mock\n'), ((51891, 51962), 'mock.call', 'mock.call', (['"""TEST"""', 'listeners[0].id'], {'provisioning_status': 'constants.ERROR'}), "('TEST', listeners[0].id, provisioning_status=constants.ERROR)\n", (51900, 51962), False, 'import mock\n'), ((52000, 52071), 'mock.call', 'mock.call', (['"""TEST"""', 'listeners[1].id'], {'provisioning_status': 'constants.ERROR'}), "('TEST', listeners[1].id, provisioning_status=constants.ERROR)\n", (52009, 52071), False, 'import mock\n'), ((55161, 55233), 'mock.call', 'mock.call', (['"""TEST"""', 'listeners[0].id'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', listeners[0].id, provisioning_status=constants.ACTIVE)\n", (55170, 55233), False, 'import mock\n'), ((55271, 55343), 'mock.call', 'mock.call', (['"""TEST"""', 'listeners[1].id'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', listeners[1].id, provisioning_status=constants.ACTIVE)\n", (55280, 55343), False, 'import mock\n'), ((55495, 55567), 'mock.call', 'mock.call', (['"""TEST"""', 'default_pool.id'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', default_pool.id, provisioning_status=constants.ACTIVE)\n", (55504, 55567), False, 'import mock\n'), ((55605, 55678), 'mock.call', 'mock.call', (['"""TEST"""', 'redirect_pool.id'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', redirect_pool.id, provisioning_status=constants.ACTIVE)\n", (55614, 55678), False, 'import mock\n'), ((55848, 55922), 'mock.call', 'mock.call', (['"""TEST"""', 'health_monitor.id'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', health_monitor.id, provisioning_status=constants.ACTIVE)\n", (55857, 55922), False, 'import mock\n'), ((56082, 56155), 'mock.call', 'mock.call', (['"""TEST"""', 'l7policies[0].id'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', l7policies[0].id, provisioning_status=constants.ACTIVE)\n", (56091, 56155), False, 'import mock\n'), ((56311, 56381), 'mock.call', 'mock.call', (['"""TEST"""', 'l7rules[0].id'], {'provisioning_status': 'constants.ACTIVE'}), "('TEST', l7rules[0].id, provisioning_status=constants.ACTIVE)\n", (56320, 56381), False, 'import mock\n'), ((57047, 57118), 'mock.call', 'mock.call', (['"""TEST"""', 'listeners[0].id'], {'provisioning_status': 'constants.ERROR'}), "('TEST', listeners[0].id, provisioning_status=constants.ERROR)\n", (57056, 57118), False, 'import mock\n'), ((57156, 57227), 'mock.call', 'mock.call', (['"""TEST"""', 'listeners[1].id'], {'provisioning_status': 'constants.ERROR'}), "('TEST', listeners[1].id, provisioning_status=constants.ERROR)\n", (57165, 57227), False, 'import mock\n'), ((57379, 57450), 'mock.call', 'mock.call', (['"""TEST"""', 'default_pool.id'], {'provisioning_status': 'constants.ERROR'}), "('TEST', default_pool.id, provisioning_status=constants.ERROR)\n", (57388, 57450), False, 'import mock\n'), ((57488, 57560), 'mock.call', 'mock.call', (['"""TEST"""', 'redirect_pool.id'], {'provisioning_status': 'constants.ERROR'}), "('TEST', redirect_pool.id, provisioning_status=constants.ERROR)\n", (57497, 57560), False, 'import mock\n'), ((57730, 57803), 'mock.call', 'mock.call', (['"""TEST"""', 'health_monitor.id'], {'provisioning_status': 'constants.ERROR'}), "('TEST', health_monitor.id, provisioning_status=constants.ERROR)\n", (57739, 57803), False, 'import mock\n'), ((57963, 58035), 'mock.call', 'mock.call', (['"""TEST"""', 'l7policies[0].id'], {'provisioning_status': 'constants.ERROR'}), "('TEST', l7policies[0].id, provisioning_status=constants.ERROR)\n", (57972, 58035), False, 'import mock\n'), ((58191, 58260), 'mock.call', 'mock.call', (['"""TEST"""', 'l7rules[0].id'], {'provisioning_status': 'constants.ERROR'}), "('TEST', l7rules[0].id, provisioning_status=constants.ERROR)\n", (58200, 58260), False, 'import mock\n')]