Increase test coverage for glance.common.wsgi

Add unit tests for wsgi.get_socket.

Change-Id: I3850dca6f6e4dbeca0465c8d751458e255e0fed8
assertEquals is deprecated, use assertEqual (H234)

Fix last occurrences of Hacking check H234 (Python 3.x
porting issue)

Change-Id: I5444889e1837c89045996c74526e2d7a58c7a649
Switch to Hacking 0.8.x

Blacklist the few hacking warnings that still trigger, those
can be fixed in a followup commit. Start Gating on the new
tests of Hacking 0.8.x (which are all passing here).

Change-Id: I3be1a9a517ec399dd92252a7c705d1a7a6d5e4c2
Fix call to store.safe_delete_from_backend

When uploading data of a newly created image to a local filesystem
store, if the image data size exceeds the quota allocated to the user
then the operation fails with a "500 Internal Server Error".

This bug is triggered only when using chunked transfers to upload the
image data (curl and glanceclient both use chunked transfers).

When using chunked transfers the 'Content-Length' header is not set and
so the quota checking code in start of quota.ImageProxy.set_data() is
skipped. Furthermore, because of the missing size info, the store
downloads the entire image data without checking for the quota (the
quota is checked only after the image data has been downloaded and the
size determined).

If after the image data has been downloaded it is found that the quota
has been exceeded, then the StorageQuotaFull exception is raised and a
call to store.safe_delete_from_backend() made to clean up the image
data. But the 'location' and 'context' parameters to this call are given
in the wrong order and so this operation raises an (uncaught) exception,
giving rise to this bug.

This bug was not caught by existing tests because existing quota tests
don't use chunked transfer.

This commit fixes the order of the parameters and adds quota tests using
chunked transfers.

Change-Id: Ib8ab11f2115e3aead98af70788eaa45c2c33219c
Closes-bug: #1265446
Merge "Fix call to store.safe_delete_from_backend"
Merge "Increase test coverage for glance.common.wsgi"
Merge "assertEquals is deprecated, use assertEqual (H234)"
Merge "Switch to Hacking 0.8.x"