

@mock.patch.object(glance.api, 'glance')
def test_image_create_additional_props(self, gc):
    request = self.mock_rest_request(body='{"name": "Test",\n            "disk_format": "raw", "import_data": true,\n            "container_format": "docker",\n            "visibility": "public", "protected": false,\n            "arbitrary": "property", "another": "prop",\n            "source_type": "url", "image_url": "test.com" }')
    new = gc.image_create.return_value
    new.to_dict.return_value = {
        'name': 'testimage',
    }
    new.name = 'testimage'
    metadata = {
        'name': 'Test',
        'disk_format': 'raw',
        'container_format': 'docker',
        'copy_from': 'test.com',
        'is_public': True,
        'protected': False,
        'min_disk': 0,
        'min_ram': 0,
        'properties': {
            'arbitrary': 'property',
            'another': 'prop',
        },
    }
    response = glance.Images().post(request)
    self.assertStatusCode(response, 201)
    self.assertEqual(response['location'], '/api/glance/images/testimage')
    gc.image_create.assert_called_once_with(request, **metadata)

dataset/ETHPy150Open openstack/horizon/openstack_dashboard/test/api_tests/glance_rest_tests.py ImagesRestTestCase.test_image_create_additional_props/original