Debug env for tox

Running a test with pdb was difficult because testr captures
output and causes pdb prompt to quit.

Tips for how to run testr with debug are provided here:
  https://wiki.openstack.org/wiki/Testr#Debugging_.28pdb.29_Tests

This change puts these commands into a debug env in tox.ini so
you can do a command like

 tox -e debug test_auth_token_middleware

or, for more granularity:
 tox -e debug keystone.tests.test_sql_migrate_extensions.EndpointFilterExtension
 tox -e debug keystone.tests.test_sql_migrate_extensions.EndpointFilterExtension.test_downgrade

and when it hits your breakpoint you'll get the debug prompt.

This same change was made to keystone in commit c8302509 .

Change-Id: I2b5dc81f4652dc89ecbcc7c785245a81cf77a1ca
Verify token binding in auth_token middleware

The server side has had token bind checking implemented for a while. Now
that it is possible to generate bound tokens auth_token middleware
should be capable of verifying them.

Change-Id: I4f9c5855ab3102333b0738864c506e2501bf9c7e
Saner debug log message generation

For some reason building the debug log would include spaces in the
message elements and join on the empty string. It makes much more sense
to just build the list and join on the space.

Change-Id: Idd82787b87518c56122d0b13551f84529306337c
Tests cleanup temporary files

Some tests in test_auth_token_middleware weren't cleaning up
temporary files because the original filename was lost when
set_middleware() was called twice or tearDown() didn't clean up
the files.

The fix strategy is to use cleanUp(), because it will delete all
files even if called multiple times, and it doesn't rely on
tearDown() being called in subclasses.

Change-Id: Ib78150378ba6b622c9bc451ef4b331a87c17c56a
auth_token tests close temp file descriptor

The auth_token middleware tests were failing to close the
file descriptor of the named temporary file.

The fix strategy is to use tempfile.NamedTemporaryFile in a
context manager rather than mkstemp.

Change-Id: Ie20e2b4faa6a0d6bb8c4817ed2c9a04adee96f0f
Updated from global requirements

Change-Id: Ia662a33f3615611c380ff5862f74f18ea459bf8e
Make assertQueryStringIs usage simpler

As requested in https://review.openstack.org/#/c/65728/, this "fixes"
assertQueryStringIs so it takes a query string, rather than a dict
of lists, which is a less convenient format in many tests.

Change-Id: Ib4c49ba71f7e12bb5bcb4dfde77974f3418c7854
Fix incorrect assertTrue usage

Several self.assertTrue(len(returned_list)) statements exist,
which don't make any sense as we're testing an integer length
as a boolean.  Instead test the returned list length matches
the list passed in to stub the request.

Change-Id: I713c3a6afcc93ebb2a8f7ffde45aade2154ebf2c
Merge "Debug env for tox"
Merge "Updated from global requirements"
Merge "Verify token binding in auth_token middleware"
Merge "Make assertQueryStringIs usage simpler"
Clarify roles validation error messages

When doing the xor validation tests, we should differentiate between
the case where the user passed both arguments vs passing neither,
otherwise the error message is confusing when you don't pass either.

Change-Id: I99c307339ccd045a4c5b71824f3b7d91e2908154
Merge "Saner debug log message generation"
Merge "Fix incorrect assertTrue usage"
Fix discover command failed to read extension list issue

Fix the key error which caused discover command failed to read the
response body of extension list result. This change also added test
cases to cover the use case of generic client extension discovery.

Change-Id: Id687f8d73cead28f594de00d3b5ff9086558947b
Closes-Bug: #1266710
Sync with global requirements

Change-Id: I366b3a23bcb82203b347fa13f0385024bae62cab
Replace assertTrue with explicit assertIsInstance

assertIsInstance can provide useful message when test fails,
this patch replaces assertTrue(isinstance(x, y)) with
assertIsInstance(x, y).

Change-Id: I1a36b4f343c881b6690389753270d35599b758ab
Closes-Bug: #1268480
Adjust import items according to hacking import rule

This patch adjust import items and add missing blank lines acording
to http://docs.openstack.org/developer/hacking/#imports
{{stdlib imports in human alphabetical order}}
\n
{{third-party lib imports in human alphabetical order}}
\n
{{project imports in human alphabetical order}}
\n
\n
{{begin your code}}

hacking project also enforce some checks for import group.
Let make the change in keytoneclient

Change-Id: Ic83bd5ee426905588f4a2d555851a9a01fc69f02
Merge "Clarify roles validation error messages"