Refactor glance/tests/unit/v1/test_registry_client.py

Remove code duplication from module

Partially implements blueprint glance-tests-code-duplication

Change-Id: I85f5d7a45c65533ba49f2dfdefdfccfde221468b
Use built-in print() instead of print statement

In python 3 print statement is not supported, so we should use
only print() functions.

Fixes bug 1226943

Change-Id: I0ae4cc7e5996ed30c69e153ba51438c56e56c09a
Using policies for protected properties

This patch extends the way we can define rules for property protections.
It allows us to use the roles/rules defined in policy.json and leverage
the policy language for property protections as well.

DocImpact

Related to bp api-v2-property-protection

Change-Id: I4789ebb2645171280185d2c76138e78d954b5954
optimize queries for image-list

- avoid full table scan on images table by converting,
images.is_public = 1 OR images.owner = 'OWNER'
to
query WHERE images.is_public = 1
UNION
query WHERE images.owner = 'OWNER'
- move image related conditions to the inner union queries
- remove unwanted union of queries in case of admin querying for image list
- change the condition images.status != 'killed' to images.status in ('active', 'saving', 'queued', 'pending_delete', 'deleted')
- convert the correlation subqueries that are used for image_property filters into inner joins

Fixes bug 1211315

depends on bug 1214830

Change-Id: Ie7458044edbe1ef64871bcf5ef4996ed3cc0f957
Merge "Refactor glance/tests/unit/v1/test_registry_client.py"
Merge "Use built-in print() instead of print statement"
Merge "optimize queries for image-list"
Merge "Using policies for protected properties"