

def create_node_group(self, api=True, expect_errors=False, cluster_id=None, **kwargs):
    cluster_id = self._get_cluster_by_id(cluster_id).id
    ng_data = {
        'cluster_id': cluster_id,
        'name': 'test_ng',
    }
    if kwargs:
        ng_data.update(kwargs)
    if api:
        resp = self.app.post(reverse('NodeGroupCollectionHandler'), jsonutils.dumps(ng_data), headers=self.default_headers, expect_errors=expect_errors)
        ng = resp
    else:
        ng = NodeGroup.create(ng_data)
        db().flush()
    return ng

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