Allow v2 client authentication with trust_id

It should be possible to authenticate against the v2 tokens
API with a trust_id, because it suports rescoping an existing
token to a trust, this patch adds client support for this.

Note with the current keystone code it's necessary to pass the
trustor tenant ID when rescoping with a trust where
impersonation==True, e.g:

c = client_v2.Client(username=TRUSTEE_USERNAME,
                     password=TRUSTEE_USERNAME,
                     tenant_name=TRUSTEE_TENANT_NAME,
                     auth_url=OS_AUTH_URL_V2)
c.authenticate(trust_id=trust_i.id, tenant_id=TRUSTOR_TENANT_ID)

Change-Id: I177c41af298b7437e2c6fb437aa9ce9a09773b9d
Closes-Bug: #1231483
Fixes print error for keystone action with non-English characters

When processing keystone tenant-delete action with non-English
characters, printing the exception traceback will result in a
UnicodeEncodeError, so should encode text with safe_encode.

Fixes bug #1231472

Change-Id: Ic2599c51513189c132e31aa87d0d15df81802688
Fix H202 assertRaises Exception

Align the hacking version between test-requirement and global requirement.

The change of H202 detection from 0.6 to 0.7 in hacking is:

-    if logical_line.startswith("self.assertRaises(Exception)"):
+    if logical_line.startswith("self.assertRaises(Exception,"):

then more cases are detected by this change. Fix the exposed H202 error.

There is a special test case:
tests/v3/test_endpoints.py:test_update_invalid_interface

ref = self.new_ref(interface=uuid.uuid4().hex)

this line can not generate proper parameter for self.manager.update,
add a parameter "endpoint" for it, according to the
definition in keystoneclient/v3/endpoints.py:EndpointManager.update.

Otherwise, there will be following error after changing the Exception
to exceptions.ValidationError:
TypeError: update() takes at least 2 arguments (6 given)

Fixes Bug #1220008

Change-Id: I8f7ed7a6eebf8576a6db5fecd86b9d19a15c8d60
assertEquals is deprecated, use assertEqual (H602)

Change-Id: Iefd087320659909b89864018ccb4ccf50a75aff6
Normalize datetimes to account for tz

This patch makes sure that datetimes in the auth_token middleware
are normalized to account for timezone offsets.

Some of the old tests were changed to ensure that the expires string
stored in the cache is in ISO 8601 format and not a random float.

Fixes bug 1195924

Change-Id: I5917ab728193cd2aa8784c4860a96cdc17f3d43f
Merge "Fix H202 assertRaises Exception"
Merge "Normalize datetimes to account for tz"
python3: Make iteritems py3k compat

Use six.iteritems to replace dictionary.iteritems() on python2 or
dictionary.items() on python3.

Change-Id: I972f065414e22d287bd7e00ab2c6e754f17afb75
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Updated from global requirements

Change-Id: I4f26d3a8790c799e5c1f7f81031406e0c57545f9

Change-Id: Ica7315effe308bd739e90f885849fac27a3c542b

Change-Id: I2cc2769b89bd040064408faea30c448350fa5f00
Merge "assertEquals is deprecated, use assertEqual (H602)"
Merge "Fixes print error for keystone action with non-English characters"
python3: Refactor dict for python2/python3 compat

Python3 changed the behavior of dict.keys such that it is now
returns a dict_keys object, which is iterable but not indexable.
You can get the python2 result back with an explicit call to list.

Change-Id: Ic504d3929398aa82ac87d1735cf4cedea2dfc5d1
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Sync jsonutils from oslo

Synce the changes of jsonutils from oslo, following fixes are synced:

Ia915f3175bee370d747e362cd9d35d8536c1b7b2
Id1aa7af26b0f5d929337cc373c6a4f802bba2cec
Ic94f238a5f92f28ae1b6154fb56f00c4c9fa3283
I8b246f20f9001379fcb5ca3a84aabee3847cb945

Most of them are py33 fixes, and keystoneclient is required by a dozen of
projects, we should update it to avoid py33 issue in dependent projects.

Closes-Bug #1239602

Change-Id: I65c28896d1551fd537dd7774e87bc479a477a7ab
Merge "python3: Make iteritems py3k compat"
Merge "Allow v2 client authentication with trust_id"
Add AssertRequestHeaderEqual test helper and make use of it

This will be a fairly common pattern and so should be a helper of its
own.

Change-Id: Ic06add6dfe40c7d3ab88dfdd99a9087fdebd9b67
Merge "Updated from global requirements"
Replace OpenStack LLC with OpenStack Foundation

Some files still use trademark OpenStack LLC in header, which
should be changed to OpenStack Foundation.

NOTE: tools/install_venv.py is not touched, should sync with oslo

Change-Id: I01d4f6b64cf1a152c4e190407799ce7d53de845f
Fixes-Bug: #1214176
Merge "Sync jsonutils from oslo"
Merge "python3: Refactor dict for python2/python3 compat"