

def launch_verify_networks(self, data=None, expect_errors=False, cluster_id=None):
    if self.clusters:
        cluster = self._get_cluster_by_id(cluster_id)
        net_urls = {
            'nova_network': {
                'config': 'NovaNetworkConfigurationHandler',
                'verify': 'NovaNetworkConfigurationVerifyHandler',
            },
            'neutron': {
                'config': 'NeutronNetworkConfigurationHandler',
                'verify': 'NeutronNetworkConfigurationVerifyHandler',
            },
        }
        provider = cluster.net_provider
        if data:
            nets = jsonutils.dumps(data)
        else:
            resp = self.app.get(reverse(net_urls[provider]['config'], kwargs={
                'cluster_id': cluster.id,
            }), headers=self.default_headers)
            self.tester.assertEqual(200, resp.status_code)
            nets = resp.body
        resp = self.app.put(reverse(net_urls[provider]['verify'], kwargs={
            'cluster_id': cluster.id,
        }), nets, headers=self.default_headers, expect_errors=expect_errors)
        if expect_errors:
            return resp
        else:
            task_uuid = resp.json_body['uuid']
            return self.db.query(Task).filter_by(uuid=task_uuid).first()
    else:
        raise NotImplementedError('Nothing to verify - try creating cluster')

dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/test/base.py EnvironmentManager.launch_verify_networks/original