def test_network_conf_not_applied_on_vip_allocation_error(self):
        resp = self.env.neutron_networks_get(self.cluster.id)
        net_conf = resp.json_body

        old_cidr = ''

        for net in net_conf['networks']:
            if net['name'] == 'management':
                old_cidr = net['cidr']
                net['cidr'] = net['cidr'].partition('/')[0] + '/25'

        with patch(
                'nailgun.extensions.network_manager.'
                'manager.AllocateVIPs70Mixin.'
                '_get_vips_for_net_groups', new=Mock(side_effect=Exception)
        ) as m_assign:
            resp = self.env.neutron_networks_put(self.cluster.id,
                                                 net_conf,
                                                 expect_errors=True)

        self.assertEqual(resp.status_code, 500)

        self.db.refresh(self.cluster)
        net = [ng for ng in self.cluster.network_groups
               if ng.name == 'management'].pop()

        self.assertEqual(net.cidr, old_cidr)
        self.assertTrue(m_assign.called)  # Verifies no other error occured
dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/test/integration/test_network_configuration.py/TestNeutronNetworkConfigurationHandler.test_network_conf_not_applied_on_vip_allocation_error/original