Merge "Port script utils to Python 3"
This commit is contained in:
commit
047773ccde
|
@ -97,9 +97,9 @@ def validate_location_uri(location):
|
||||||
elif location.startswith(("file:///", "filesystem:///")):
|
elif location.startswith(("file:///", "filesystem:///")):
|
||||||
msg = _("File based imports are not allowed. Please use a non-local "
|
msg = _("File based imports are not allowed. Please use a non-local "
|
||||||
"source of image data.")
|
"source of image data.")
|
||||||
# NOTE: raise Exception and let the encompassing block save
|
# NOTE: raise BadStoreUri and let the encompassing block save the error
|
||||||
# the error msg in the task.message.
|
# msg in the task.message.
|
||||||
raise StandardError(msg)
|
raise exception.BadStoreUri(msg)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# TODO(nikhil): add other supported uris
|
# TODO(nikhil): add other supported uris
|
||||||
|
|
|
@ -89,9 +89,10 @@ class TestScriptsUtils(test_utils.BaseTestCase):
|
||||||
script_utils.validate_location_uri, '')
|
script_utils.validate_location_uri, '')
|
||||||
|
|
||||||
def test_validate_location_file_location_error(self):
|
def test_validate_location_file_location_error(self):
|
||||||
self.assertRaises(StandardError, script_utils.validate_location_uri,
|
self.assertRaises(exception.BadStoreUri,
|
||||||
"file:///tmp")
|
script_utils.validate_location_uri, "file:///tmp")
|
||||||
self.assertRaises(StandardError, script_utils.validate_location_uri,
|
self.assertRaises(exception.BadStoreUri,
|
||||||
|
script_utils.validate_location_uri,
|
||||||
"filesystem:///tmp")
|
"filesystem:///tmp")
|
||||||
|
|
||||||
def test_validate_location_unsupported_error(self):
|
def test_validate_location_unsupported_error(self):
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -28,6 +28,8 @@ commands =
|
||||||
glance.tests.unit.async.flows.test_introspect \
|
glance.tests.unit.async.flows.test_introspect \
|
||||||
glance.tests.unit.async.test_async \
|
glance.tests.unit.async.test_async \
|
||||||
glance.tests.unit.async.test_taskflow_executor \
|
glance.tests.unit.async.test_taskflow_executor \
|
||||||
|
glance.tests.unit.common.scripts.image_import.test_main \
|
||||||
|
glance.tests.unit.common.scripts.test_scripts_utils \
|
||||||
glance.tests.unit.common.test_client \
|
glance.tests.unit.common.test_client \
|
||||||
glance.tests.unit.common.test_config \
|
glance.tests.unit.common.test_config \
|
||||||
glance.tests.unit.common.test_exception \
|
glance.tests.unit.common.test_exception \
|
||||||
|
|
Loading…
Reference in New Issue