

def test_create_root_volume(self):
    body = dict(server=dict(name='test_server', imageRef=3, flavorRef=2, min_count=1, max_count=1, block_device_mapping=[dict(volume_id=1, device_name='/dev/vda', virtual='root', delete_on_termination=False)]))
    req = webob.Request.blank('/v1.1/fake/os-volumes_boot')
    req.method = 'POST'
    req.body = json.dumps(body)
    req.headers['content-type'] = 'application/json'
    res = req.get_response(fakes.wsgi_app())
    self.assertEqual(res.status_int, 200)
    server = json.loads(res.body)['server']
    self.assertEqual(1, server['id'])
    self.assertEqual(2, int(server['flavor']['id']))
    self.assertEqual('test_server', server['name'])
    self.assertEqual(3, int(server['image']['id']))
    self.assertEqual(16, len(server['adminPass']))

dataset/ETHPy150Open nii-cloud/dodai-compute/nova/tests/api/openstack/contrib/test_volumes.py BootFromVolumeTest.test_create_root_volume/original