glance/glance/tests/unit
bhagyashris 89feef0e2f Move 'upload_image' policy check to the controller
There are two methods to create images:-

Method A)
POST /v2/images
PUT /v2/images/{image_id}/file

Method B)
POST /v2/images
PUT /v2/images/{image_id}/stage
POST /v2/images/{image_id}/import

The traditional image upload API (PUT /v2/images/{image_id}/file)
uses 'upload_image' policy which is same for
Method B (POST /v2/images/{image_id}/import)
image-create-via-import(new API for image create) API.

The long term goal is to make users use method B to create images
and cross services to use Method A until changes are made to
use Method B.
To restrict normal users from using Method A to create images both
these APIs (/v2/images/{image_id}/file and /v2/images/{image_id}/import)
should have a distinct policy.

This patch move the 'upload_image' policy check from imge.set_data()
to the controller and not introduce any new policies at this point
for import API call (POST /v2/images/{image_id}/import)
on the theory that an operator can stop import by restricting the
'image_create' policy. And also this fix will not change the semantics
of the 'upload_image' policy from the operator perspective.

Closes-Bug: #1732141
Change-Id: Icc62add5f8d48549aac94c8058d66d6b77b56d41
2017-12-11 19:58:18 +05:30
..
api Remove use of deprecated optparse module 2017-10-01 07:08:00 -05:00
async Merge "Changes behaviour when an image fails uploading" 2017-12-01 08:11:01 +00:00
common Merge "Optimize the way to serach file 'glance-api-paste.ini'" 2017-11-15 08:23:31 +00:00
image_cache Handle file delete races in image cache 2017-07-10 11:37:55 -05:00
v1 Remove unused None from dict.get() 2017-07-05 12:49:10 +00:00
v2 Move 'upload_image' policy check to the controller 2017-12-11 19:58:18 +05:30
__init__.py Empty files shouldn't contain copyright nor license 2013-12-24 22:39:05 -06:00
base.py Don't use config option sqlite_db 2016-08-16 13:42:02 +08:00
fake_rados.py Fixes rbd _delete_image snapshot with missing image 2013-10-07 23:15:49 +01:00
test_auth.py Extracted HTTP response codes to constants in tests 2016-10-06 15:17:06 +00:00
test_cache_middleware.py Fix glance image-download error 2017-07-11 11:01:48 -05:00
test_cached_images.py Improved coverage for glance.api.* 2014-06-15 17:44:09 +00:00
test_context.py Use new oslo.context arg names 2017-11-27 10:20:10 -06:00
test_context_middleware.py Support Unicode request_id on Python 3 2015-11-27 15:44:54 +01:00
test_data_migration_framework.py Change identifiers in data migration tests 2017-02-28 11:15:28 -06:00
test_db.py Prevent v1_api from making requests to v2_registry 2017-02-09 18:44:08 +00:00
test_db_metadef.py Don't use slashes for long lines - use parentheses instead 2015-08-16 07:21:13 +00:00
test_domain.py Glare-ectomy 2017-03-01 21:46:52 +00:00
test_domain_proxy.py Fix for Image members not generating notifications 2016-01-25 04:50:58 -08:00
test_glance_manage.py Provide user friendly message for FK failure 2017-04-05 15:56:32 +05:30
test_glance_replicator.py Replace master/slave usage in replication 2017-03-22 23:46:47 +00:00
test_image_cache.py Port image cache to Python 3 2015-08-16 11:49:45 +02:00
test_image_cache_client.py Do not use service catalog for cache client 2016-11-07 16:38:52 +00:00
test_manage.py Add expand/migrate/contract commands to glance-manage CLI 2017-02-01 23:23:11 +00:00
test_misc.py Port v1.test_registry_api to Python 3 2015-10-22 22:53:05 +02:00
test_notifier.py Merge "Added unit tests for disabled notifications in Notifier" 2016-11-22 04:03:23 +00:00
test_policy.py Move 'upload_image' policy check to the controller 2017-12-11 19:58:18 +05:30
test_quota.py Tests: Remove the redundant methods 2017-06-20 15:55:01 +08:00
test_schema.py Fix assertEqual arguments order 2014-09-19 00:25:18 +08:00
test_scrubber.py Tests: Remove the redundant methods 2017-06-20 15:55:01 +08:00
test_store_image.py Use cursive for signature verification 2016-08-31 12:18:10 -07:00
test_store_location.py Upgrade to hacking 0.10 2015-01-13 15:03:27 +01:00
test_versions.py Fix Image API 'versions' response 2017-08-19 13:00:20 -04:00
utils.py Move 'upload_image' policy check to the controller 2017-12-11 19:58:18 +05:30