

def _check_success_message(self, callback, task_name, c_status, n_status):
    cluster = self.env.create(cluster_kwargs={
        
    }, nodes_kwargs=[{
        'api': False,
        'roles': ['controller'],
        'status': consts.NODE_STATUSES.discover,
    }, {
        'api': False,
        'roles': ['compute'],
        'status': consts.NODE_STATUSES.discover,
    }])
    nodes = self.env.nodes
    task_title = task_name.title()
    task = Task(uuid=str(uuid.uuid4()), name=task_name, cluster_id=n_status.id)
    task.cache = {
        'nodes': [nodes[0].uid, nodes[1].uid],
    }
    self.db.add(task)
    self.db.flush()
    params = {
        'task_uuid': task.uuid,
        'status': consts.TASK_STATUSES.ready,
        'progress': 100,
        'nodes': [{
            'uid': nodes[0].uid,
            'status': n_status,
        }],
    }
    callback(**params)
    self.assertEqual('{0} of 1 environment node(s) is done.'.format(task_title), task.message)
    self.db.refresh(cluster)
    self.assertEqual(consts.CLUSTER_STATUSES.partially_deployed, cluster.status)
    params['nodes'] = []
    callback(**params)
    self.assertEqual('{0} is done. No changes.'.format(task_title), task.message)
    params['nodes'] = [{
        'uid': nodes[1].uid,
        'status': n_status,
    }]
    callback(**params)
    self.assertEqual("{0} of environment '{1}' is done.".format(task_title, cluster.name), task.message)
    self.db.refresh(cluster)
    self.assertEqual(c_status, cluster.status)

dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/test/integration/test_rpc_consumer.py TestConsumer._check_success_message/VarMisuse@125/167 `cluster`->`n_status`