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
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
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"
Python 3: fix the _calc_signature_* functions

This commit makes the _calc_signature_* functions work in python 3. The issues
were usual text strings vs bytes that arise when porting code to Python 3.

Change-Id: I36b40012b09d4f72e9248b49d51dc545d70abfc6
Respect region name when processing domain URL

When deprecating the use of management_url from service_catalog we
updated the management_url setter for the project scoped token, however
we missed the domain scoped token case.

There is actually nothing we can do here to test this scenario as the
backwards compatibility code that was installed handles this for us and
there is no problem, however we should not be internally relying on
deprecated code.

Change-Id: I59bac4d9d74f2eb8bc6edd40518c7cd5a4fe1343
Merge "Tests cleanup temporary files"
Merge "auth_token tests close temp file descriptor"
Sort items in requirement related files

Update two requirement related files with command: sort-i {filename}.
This make these files more readable, can find the libraries easily.

Change-Id: I5969ef37d02814bf2c09761f133464c5a02f0d6b
Tests use cleanUp rather than tearDown

The tests were putting clean-up code in tearDown. Using tearDown
causes problems with developing and testing because if there's an
exception raised in setUp then tearDown is not called and this
can affect other tests and make it hard to figure out what the
problem was.

Also, this should make it easier to switch to using fixtures since
fixtures use cleanUp.

Change-Id: Ifc22dfd9012402c895a09534f4b1d9bd7a2ec931
Remove test_print_{dict,list}_unicode_without_encode

These tests do not really make sense: they expect the strutils.safe_encode()
method to fail for some reason.

Change-Id: I2ca07c06f86e4d83ae153601a0dab9a8f393f3e3
Python 3: set webob.Response().body to a bytes value

In Python 3, the body attribute of a webob.Response instance has type 'bytes':

    >>> import webob
    >>> type(webob.Response().body)
    <class 'bytes'>

Change-Id: Ic60454dd1713ebd5ae84daaa113ccb0270ca37ed
Using common method 'bool_from_string' from oslo strutils

Using common method 'bool_from_string' from oslo strutils to replace
utils.string_to_bool.

partially implements blueprint common-client-library-2

Change-Id: I22ee9c5a4b48e85606e033ab87d4adb72b665ee6
Consistently support kwargs across all v3 CRUD Manager ops

Co-Authored-By: Saju Madhavan <sajuptpm@gmail.com>
Closes-Bug: 1047867
Implements: blueprint extensible-crud-manager-operations
Change-Id: I64e11bcf3797eb84e4695605daea9749259d78ec
Merge "Replace assertTrue with explicit assertIsInstance"
Fix typos in documents and comments

Fix typos detected by toolkit misspellings.

* pip install misspellings
* git ls-files | grep -v locale | misspellings -f -

Change-Id: Ifbbc29537d9d129aad238de6c37718c4fbb8349b