Fix the order of assertEqual arguments(keystoneclient, kvs, etc)

assertEqual method's arguments should be in
('expected', 'actual') order.

Change-Id: Ic429c9264a823c3b03ca3b5c898b4aeb96891504
Partial-Bug: #1277104
Fix test_provider_token_expiration_validation transient failure

The keystone.tests.test_token_provider.TestTokenProvider.
test_provider_token_expiration_validation test would fail if the
tests weren't run before the expiration period passed. This could
happen if the system was slow and the previous tests took a long
time causing a potential transient failure.

Change-Id: I123aadd55770002fe1c9ed9b17669d5212198aa3
Closes-Bug: #1278550
Use assertIn in test_v3_catalog

assertEqual was used where assertIn should have been. assertIn
will provide a more useful error message.

Change-Id: I97ccbb8579ea726fd76c520d0573fdcbf5a261d7
Cleanup revocation query

The code in the revoke sql backend to calculate the query for the
list of events was creating a temporary and then discarding it,
and blaming not using it on sqlite.

Rather than discard the temporary, a reference is kept to it so
that it can be used.

Change-Id: Ifdb6a70900af85869b43d319eab8aa2a6b2bc162
Remove unnecessary test setUps

There is no reason to have a setUp case if all we do is chain to the
parent.

Change-Id: Id31281a9d50588f036e03b458ccfb71d1010f2d6
Properly handle unicode & utf-8 in LDAP

This patch adds all the necessary type conversions between the LDAP
API's.

* string literals are unicode

* unicode strings are utf-8 encoded before calling LDAP

* utf-8 strings received from the LDAP API are decoded into unicode

* string classes use the six.text_type for Python 2 vs. Python 3
  compatibility

* the fake LDAP implementation was reworked such that it's external
  API only handles UTF-8 encoded strings but only uses unicode
  internally. This is because internally it must be able to operate on
  logical characters in order to perform string operations on it's
  data. This is very much akin to what happens in a real LDAP
  implementation, the interface is UTF-8 but operations occur on
  decoded logical characters.

Unicode tests that were skipped are now re-enabled.

Partial-Bug: 1172106
Change-Id: Icce6b508f748214e241de40c3c9389b2caccea83
Expand the use of non-ascii values in ldap test

Very few of the ldap tests were using non-ascii values, in fact
non-ascii values were restricted to only specific tests that
had 'unicode' in their test name. This is very weak test coverage.

This patch replaces all occurances of 'fake1', the standard string
used in the tests for test value with 'fäké1' where the a has an
umlaut and the e has a diacritical. Visually they look almost the
same but will trigger the type of encoding exceptions we've seen
in the past.

Closes-Bug: 1172106

Change-Id: I03b10f3da93a8fb388baacb00532c03019f327c0
Fix assertEqual arguments order(auth_plugin, backend, backend_sql, etc)

assertEqual method's arguments should be in
('expected', 'actual') order.

Change-Id: I111c9caf415fa5d03f2e06785c01316bd6a7617e
Partial-Bug: #1277104
Safer noqa handling

"# flake8: noqa" was used in several files. This causes the
entire file to not be checked by flake8. This is unsafe, and
"# noqa" should be used only on those lines that require it.

E712 doesn't honor #noqa, so work around it by assigning True to a
variable.

Change-Id: I1ddd1c4f4230793f0560241e4559095cb4183d71
test_v3_token_id correctly hash token

The test_v3_token_id test was calculating the token hash by
parsing the response JSON and generating a new JSON document.
This isn't guaranteed to work because a Python dict can have its
fields in any order[1], so the new JSON document may not match the
response JSON and you'd get a different hash. The correct way to
generate a token hash is to use the response as is.

[1] http://docs.python.org/2/library/stdtypes.html#dict.items

Change-Id: I1a79c252916c4459fdc75a6e022d72c0c14582ef
Moves database setup/teardown closer to its usage

The setup code needed third party Python modules that are not Python 3
compatible to be imported. This made it impossible to run any test under
Python 3 without doing a bit of sys.modules magic.

bp python3

Change-Id: Ife1af897018b95c9f22c5aa42cd9319a4182b58d
Check domain_id with equality in assignment kvs

It was noticed in https://review.openstack.org/70816 that the kvs
assignment backend was using a contains check instead of an equality
check which comparing domain_ids.

Change-Id: Ib1b51298c8171151844caaa5ab694117e68374e7
Cleanup ldap tests (mox and reset values)

When running concurrent test workers, the structure used to test
the instantiation of the FakeLdap handler was relying on mox. In
some cases the test structures were not reset during teardown.

The test cases were not clearing out the _HANDLERS in the common
ldap module. This has been corrected with an addCleanup and moving
the setUp logic to the BaseLDAPIdentity class instead of the
LDAPIdentity class.

Change-Id: I2976774dabeb2b9196b3f25c02838bf4c4688d94
Merge "test_v3_token_id correctly hash token"
Merge "Use assertIn in test_v3_catalog"
Merge "Fix test_provider_token_expiration_validation transient failure"
Merge "Cleanup revocation query"
Merge "Remove unnecessary test setUps"
Merge "Properly handle unicode & utf-8 in LDAP"
Merge "Expand the use of non-ascii values in ldap test"