Improve test/utils.py

Introduce new class into utils.py to keep glance api tests DRYer

Partially implements blueprint glance-tests-code-duplication

Change-Id: Ic77961fcc83806fd451afa1a0d230f09926ebfd9
Refactor glance/tests/unit/v1/test_registry_client.py

Remove code duplication from module

Partially implements blueprint glance-tests-code-duplication

Change-Id: I85f5d7a45c65533ba49f2dfdefdfccfde221468b
Refactor glance/tests/unit/v2/test_registry_client.py

Remove code duplication from module

Partially implements blueprint glance-tests-code-duplication

Change-Id: Idf54d98d0982b7c64696056c87283eb92f1164b5
Code dedup in glance/tests/unit/v1/test_registry_api.py

Move duplicated fixture set-ups, requests and assertions to tests.utils.py

bp glance-tests-code-duplication

Change-Id: Ie0f13b5f5d5a242f24ac7cd6cc548ff09ebe6ba5
Avoid redefinition of test

test_add_member() is defined twice under the same
name, however checking for different things. Rename
the 2nd instance to _unauthorized to avoid overwriting
the first implementation.

The first check is actually duplicate to test_add_member_positive.
So merging the first check with test_add_member_positive.

Change-Id: Ifb029d8f34f9f4139557bb9b197492fb344a598e
Remove start index 0 in range()

Remove the useless arg ("start index" = 0) in files, since its default
value is 0, to make code cleaner.

Change-Id: I9d91ab8a8033b9a6c9b77608dea92c91a994c7fc
Changed header from LLC to Foundation based on trademark policies

Fixes: Bug 1214176

Change-Id: I4e394c33d810fe7d48066ff7cb6143f7eae25f13
Remove the unused mapper of image member create

For image members v1, we don't support "create" method,
but we're mapping it in router.py. So this fix will
remove the unused mapper.

Fixes bug 1223658

Change-Id: I20401656ea2930a026cf8b67825d9ec9f6623487
Fix misused assertTrue in unit tests

Refactored unit tests to use assertEqual instead of assertTrue
where needed.

Fixes bug #1226374

Change-Id: Iac5117c7a8dd3769aa6e303c6830aad291d5a0f7
Fix typo in config string

Add a single space to change "isthis" to "is this".

Change-Id: I95a001f5025ef4c41467b363cdd3adf8258e8f10
Enclose command args in with_venv.sh

Sync tools/with_venv.sh from oslo, it will support argument with
blanks.

Change-Id: Ibb802b21d609ea6b54fc168b17705f06ad1cb86a
Closes-Bug: #1220937
Log a message when image object not found in swift

We should log when a request for an image object in swift returns a 404.

Fix for bug 1227786.

Change-Id: I27a970840cf448196245ba1e58523b9e0b1495f5
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
Convert Windows to Unix style line endings

This is more consistent with other files and fixes
Hacking warning H601.

Change-Id: I2ba5436df78dc82ca48bf53bc178106edd514f4c
V2 RpcApi should register when db pool is enabled

The rpc api controller registers the public methods of db_api
But, use_tpool is True, the thread pool wrapper's methods are
used which would lead to failures.

Fixes Bug #1221037

Change-Id: Iaba10178c7da1548257e2180658c2dc8ba3e048b
Do not allow the same member to be added twice

This patch add an existence check before add new member for image.

Fixes bug 1231485

Change-Id: I10d37c6f169e070ea6699cca78b6360be9fb11dc
Glance GET /v2/images fails with 500 due to erroneous policy check

This patch will fix below two issues of V2 ResponseSerializer for
images-list, image-show, image-update and image-download.

1. A user should be able to list/show/update/download image without
needing permission on get_image_location.
2. A policy failure should result in a 403 return code. We're
getting a 500.

Fixes bug 1231255

Change-Id: Ie0ec2d574eea4433c4f610ec66a22cb16cae6dc6
Allow tests to run with both provenances of mox

We currently have a requirement for mox >= 0.5.3.

Confusingly there are two flavours of "mox 0.5.3"
in the wild:

1) pypi's mox-0.5.3.tar.gz (https://pypi.python.org/pypi/mox)
2) Google's mox-0.5.3.tar.gz (https://code.google.com/p/pymox/)

These are not exactly the same; tests which can pass on (1) may
fail on (2).

Fedora packages are based on (1) while Debian/Ubuntu packages
are based on (2).

This is a known issue: https://code.google.com/p/pymox/issues/detail?id=40

When running the tests using a virtual env (1) is used, but
on Debian/Ubuntu when not running using a virtual env (2)
will be used: this leads to 3 of the 1740 tests failing.

This patch allows all 1743 tests to run whether you are running
in a virtual env or using Debian/Ubuntu/Fedora packages.

Fix for bug 1212625.

Change-Id: Ib0b11ec18aafbfb7f3d243bf149b94f93a1c13c9
Removed unsued import, HTTPError in v1/images.py.

Fixes bug 1235762

Change-Id: Ice5574f1f61d5064d73f0dd41a1f183b951e145f
Update functional tests for swift changes

It seems that a couple of changes to the store calls have slipped
through unnoticed:

* store.add() now returns a 4-tuple
* x-container-read and x-container-write headers use tenant:user rather
  than just tenant.

fixes bug 1236339

Change-Id: Ic5c311bcc2999e13203e0d3ad37bce5ac5f27e2d