Fix typo of ANS1 to ASN1

Replace is_ans1_token with is_asn1_token in test of v3 auth. This is dependent
upon the review of python-keystoneclient. https://review.openstack.org/87069

Change-Id: I5ab0205f9c58a769cd1f2a5ffe51ca37d981fe67
Closes-bug: 1306874
Fix catalog Driver signatures

The 'hints' parameter was missing from the base catalog Driver.
The 'hints' parameter is required for all the subclasses and the
manager requires it, so it should be specified in the base class.

Change-Id: I3e7d84b671468c064d6bb3b2828ce4a03fdd620b
More notification unit tests

This is to support future refactoring. The current implementation has
sections of code that were completely not tested and has tests that are
very tightly coupled to the implementation.

Change-Id: I3d8d744005ba9006cefbc0feb740cc2662f57146
Refactor test_password_hashed to the backend testers

The test_password_hashed method was defined in
test_backend.IdentityTests. This is a bad place for it because not
all backends do password hashing (for example, the LDAP backend
doesn't), and it was also implemented in a way where it called a
private method of the backend, which the SQL backend implemented
differently (it requires an SQLAlchemy session).

The test_password_hashed method is moved into the KVS backend
test class, since the current implementation is specific to the KVS
backend.

Change-Id: I0a2390412de6304b7436e6723cb2d411dd53421d
Fix sql_upgrade tests run by themselves

The tests in test_sql_upgrade would fail to run individually, with
a None dereferencing error:

 Traceback (most recent call last):
   File "keystone/tests/test_sql_upgrade.py", line 135, in setUp
     conn_str.startswith('sqlite') and
 AttributeError: 'NoneType' object has no attribute 'startswith'

Change-Id: Id05ec05a344abab8d588a4761c207e2db715e750
Fix typo on cache backend module

The correct module is 'dogpile.cache.memcached' and not
'dogpile.cache.memcache'.

Change-Id: Ie452c95dab4fcd04f65f6378c735490ee8cf4c70
Ignore broken endpoints in get_v3_catalog

Change-Id: Ifd858e9f37155e3806329c4688be494d0132a9c7
Partial-bug: #1230279
Merge "Fix typo on cache backend module"
Imported Translations from Transifex

Change-Id: I39e917b54f7bfc795e0e5785189bbc0f1db5eda4
Added statement for ... if ... else

Statement for ... if ... else was insert where it possible.

Change-Id: Ic74d9c0a9e7de597c22f72f5cef3c01ea5fd87a0
Explicit foreign key indexes.

Overview:
MySQL requires indexes on foreign keys. Such an index is created on the
referencing table automatically if it does not exist.

Motivation:
MySQL names foreign keys indexes differently dependent from itself
version. Implicit fk indexes is MySQL specific behavior, so it should be
ignored during comparision. We plan to use Alembic to compare models and
migrations I0758c7e09d1d46ce870c3f94f76c2a177955e143. Alembic doesn't support
5.5 naming convention. So we need consistent index name for all MySQL versions
to be easily ignored.

Solution:
A new migration script renames incorrectly named fk indexes on MySQL.

Reproduction:
Stop execution when foregn keys will be initialized. See schema with
your MySQL shell client. With 5.5, indexes which was not named
explicitly, will have a name such as <tablename>_<columnname>_fk, with 5.1 it
will be <columnname>.

Change-Id: I01ba0c8856afbda59394395ac319bf83a55ee2be
Partial-Bug: #1292591
Compatible server default value in the models.

MySQL has no native boolean type. MySQL boolean type is just an alias
to tiny int type field. So MySQL returns '"1"' for `true` value and
'"0"' for false value. Instead of it, Postgres has native boolean type.
Thus with Postgres, reflection of a boolean type column default value will
return either 'true' or 'false'. Model must have compatible
`server_default` argument in columns definition.

Change-Id: Id0107d510dd7087e61ae851a1f3ff18334851a68
Partial-Bug: #1292591
Updated from global requirements

Change-Id: I7d0c63125bce2d59c23a2e8da63eb0b96b169258
Sync with oslo-incubator 74ae271

This syncs Keystone with oslo-incubator commit hash
74ae2713baf82f0155b71c6e528747f644d73355 .

In keystone:

$ rm -r keystone/openstack/common

In oslo-incubator:

$ python update.py ../keystone

Commits
-------
f61a4e7 Fix python26 compatibility for RFCSysLogHandler
54f7e7f Prevent races in opportunistic db test cases
8a0f581 Use oslotest instead of common test module
7f307c2 generator: sanitize values ending with the fqdn
4a591ea Start ping listener also for postgresql
f0e50ed Add a warning to not use get_table for working with ForeignKeys
fd18c28 Fix safe_encode(): return bytes on Python 3
f0dd798 Remove rendundant parentheses of cfg help strings
6cc96d0 Fix test_gettextutils on Python 3
85d1ce6 Python 3: enable tests/unit/middleware/test_request_id.py
295fcd9 Do not use the 'extend' method on a dict_items object

Change-Id: I90dabcfce78544ceeae7d92f5e5b90d854c5da8d
Fix the "search for sql.py" files for db models

Fix the search logic for sql.py files for the db model import so
that reflection created schemas are consistent.

This does not mitigate the need to move to stevedore in the future
for loading of backends / tests, but does solve the immidiate problem.

Change-Id: If53bfb351d679e3309393c7d594942c55daff3a6
Closes-Bug: #1310768
Make the py33 Jenkins job happy

This is the first step toward getting Keystone up and running on
Python 3. This patch will create a virtualenv, but will not actually
run any tests. Future patches will enable testing modules as
incompatibilities are worked out.

bp python3

Change-Id: I1ca3bad7ec8789872791a18594cd6f3b4bf911eb
First real Python 3 tests

The goal of this changeset is to enable at least some of the tests to be
run under Python3. Even if we can't get them all to run initially it's
important that we start seeing the changes from bp keystone-py3kcompat.
Also it's important that we are checking for regressions. If we do all
this Python 3 work, but don't have automated tests in place we may
inadvertantly undo that work.

In this initial changeset I had to do some not nice things to get this
to work.

First I had to switch to using the nose test runner. testr seems to be
much more aggressive about importing everything, even when you are not
going to run the test module. This idea came from oslo. Once we have
full Python 3 support we can go back to testr.

Then I had to mock out some of the libraries that don't work on Python
3. This is unfortunate, but had to be done because keystone.test.core
indirectly imports a significant amount of the codebase.

bp python3

Change-Id: I6dd0d1b84380c4c386f70b72cdfcdf9b744c755f
setUp must be called on a fixture's parent first

There is some odd behavior when a fixture's setUp fails before it has a
change to call the parent's setUp. It causes an error in the error
handling and the original exception is lost. The bug has been reported
upstream:
  https://bugs.launchpad.net/python-fixtures/+bug/1299502

Change-Id: I27cbfbe2c8ae34e72950361f8d0d7d8d3e249f8c
Fix cache configuration checks

There were two different checks to see if a cache region was already
configured with a backend. Both were changed to use the
Region.is_configured property.

The initial reason for this change was that the hasattr approach in the
test fixture was causing some issues in Python 3. For some reason it was
forcing the __get__ lookup on the descriptor and Python 2 did not.

bp python3

Change-Id: I409656f5ede08160cc68d48e7a3a636328e3e9a6
Removed duplication with list_user_ids_for_project

Keystone list_user_ids_for_project has the possibility of returning
duplicate users if the user has more than one role in the project.
list_user_ids_for_project queries the assignment table which has
one entry for every role the user has but will now remove
duplicate combinations of target_id and actor_id. This impacts
V2 calls for tenants.list_users(<tenant_id>) and
users.list(tenant_id=<tenant_id>).

Change-Id: I9a1e5b944c2c627138851976e81d405f54fae1c9
Closes-Bug: #1308218