diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-07-27 09:02:51 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-07-27 09:02:51 +0000 |
commit | 224088a3f8be76e209f0aaa7c0cca554491d3222 (patch) | |
tree | 25ab0ed7c6a129b9c60a50e1c98ad23759765225 /openstack_dashboard/test | |
parent | 02043a98cb01dc9050dfaae5a95986b5f31dba84 (diff) | |
parent | 7e65af5f135a272eed975edd0a797c3bdf086b82 (diff) | |
download | horizon-224088a3f8be76e209f0aaa7c0cca554491d3222.tar.gz |
Merge "Embed support for external data sinks into api.glance"
Diffstat (limited to 'openstack_dashboard/test')
-rw-r--r-- | openstack_dashboard/test/api_tests/base_tests.py | 4 | ||||
-rw-r--r-- | openstack_dashboard/test/api_tests/glance_tests.py | 18 | ||||
-rw-r--r-- | openstack_dashboard/test/settings.py | 9 | ||||
-rw-r--r-- | openstack_dashboard/test/test_data/keystone_data.py | 6 |
4 files changed, 28 insertions, 9 deletions
diff --git a/openstack_dashboard/test/api_tests/base_tests.py b/openstack_dashboard/test/api_tests/base_tests.py index e707ea1bd..7780573df 100644 --- a/openstack_dashboard/test/api_tests/base_tests.py +++ b/openstack_dashboard/test/api_tests/base_tests.py @@ -190,10 +190,10 @@ class ApiHelperTests(test.TestCase): def test_url_for(self): url = api_base.url_for(self.request, 'image') - self.assertEqual('http://public.glance.example.com:9292/v1', url) + self.assertEqual('http://public.glance.example.com:9292', url) url = api_base.url_for(self.request, 'image', endpoint_type='adminURL') - self.assertEqual('http://admin.glance.example.com:9292/v1', url) + self.assertEqual('http://admin.glance.example.com:9292', url) url = api_base.url_for(self.request, 'compute') self.assertEqual('http://public.nova.example.com:8774/v2', url) diff --git a/openstack_dashboard/test/api_tests/glance_tests.py b/openstack_dashboard/test/api_tests/glance_tests.py index c3662378b..6d0feef46 100644 --- a/openstack_dashboard/test/api_tests/glance_tests.py +++ b/openstack_dashboard/test/api_tests/glance_tests.py @@ -20,6 +20,7 @@ from django.conf import settings from django.test.utils import override_settings from openstack_dashboard import api +from openstack_dashboard.api import base from openstack_dashboard.test import helpers as test @@ -311,3 +312,20 @@ class GlanceApiTests(test.APITestCase): res_types = api.glance.metadefs_resource_types_list(self.request) self.assertItemsEqual(res_types, []) + + def test_image_create_external_upload(self): + expected_image = self.images.first() + service = base.get_service_from_catalog(self.service_catalog, 'image') + base_url = base.get_url_for_service(service, 'RegionOne', 'publicURL') + file_upload_url = '%s/v1/images/%s' % (base_url, expected_image.id) + + glanceclient = self.stub_glanceclient() + glanceclient.images = self.mox.CreateMockAnything() + glanceclient.images.create().AndReturn(expected_image) + self.mox.ReplayAll() + + actual_image = api.glance.image_create(self.request, data='sample.iso') + actual_image_dict = actual_image.to_dict() + self.assertEqual(file_upload_url, actual_image_dict['upload_url']) + self.assertEqual(self.request.user.token.id, + actual_image_dict['token_id']) diff --git a/openstack_dashboard/test/settings.py b/openstack_dashboard/test/settings.py index d78a5a1c7..fdd0a4afc 100644 --- a/openstack_dashboard/test/settings.py +++ b/openstack_dashboard/test/settings.py @@ -118,10 +118,11 @@ HORIZON_CONFIG['swift_panel'] = 'legacy' find_static_files(HORIZON_CONFIG, AVAILABLE_THEMES, THEME_COLLECTION_DIR, ROOT_PATH) -# Set to True to allow users to upload images to glance via Horizon server. -# When enabled, a file form field will appear on the create image form. -# See documentation for deployment considerations. -HORIZON_IMAGES_ALLOW_UPLOAD = True +# Set to 'legacy' or 'direct' to allow users to upload images to glance via +# Horizon server. When enabled, a file form field will appear on the create +# image form. If set to 'off', there will be no file form field on the create +# image form. See documentation for deployment considerations. +HORIZON_IMAGES_UPLOAD_MODE = 'legacy' AVAILABLE_REGIONS = [ ('http://localhost:5000/v2.0', 'local'), diff --git a/openstack_dashboard/test/test_data/keystone_data.py b/openstack_dashboard/test/test_data/keystone_data.py index a57cc55f3..3b9cd1517 100644 --- a/openstack_dashboard/test/test_data/keystone_data.py +++ b/openstack_dashboard/test/test_data/keystone_data.py @@ -68,9 +68,9 @@ SERVICE_CATALOG = [ "endpoints_links": [], "endpoints": [ {"region": "RegionOne", - "adminURL": "http://admin.glance.example.com:9292/v1", - "internalURL": "http://int.glance.example.com:9292/v1", - "publicURL": "http://public.glance.example.com:9292/v1"}]}, + "adminURL": "http://admin.glance.example.com:9292", + "internalURL": "http://int.glance.example.com:9292", + "publicURL": "http://public.glance.example.com:9292"}]}, {"type": "identity", "name": "keystone", "endpoints_links": [], |