Fix misused assertTrue in unit tests

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

Fixes bug #1226374

Change-Id: Iac5117c7a8dd3769aa6e303c6830aad291d5a0f7
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
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
Merge "Allow tests to run with both provenances of mox"
Glance manage should parse glance-api.conf

glance-manage does not currently parse glance-api.conf, when
glance-registry.conf is present. Currently it's parsed conditionally.
But, when some configs from glance-api.conf are required, we would
need parse them both.
eg. CONF.swift_store_user, CONF.swift_store_key in glance-api.conf

Fixes bug #1225863

Change-Id: I553c1bb460229489b38a57d9c91995816bfe09ee
Adding 'download_image' policy enforcement to image cache middleware

Currently image cache middleware not care 'download_image' policy, the
enforcement caused user receive empty content but with HTTP 200 code
rather than 403 when client attempt to download image using v2 API. And
the real Forbidden exception be logged in glance-api log which image
application action raised. The end user is confused by this behavior.

Fixes bug: 1235378

Change-Id: Ibaa7ccf8613ee3cce4cb6a72e3206a2c94122222
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Merge "Fix misused assertTrue in unit tests"
Merge "Do not allow the same member to be added twice"
Merge "Glance manage should parse glance-api.conf"