keystone/keystone/tests/unit
wangxiyuan 012dac29b8 Enable foreign keys for unit test
The unit test uses sqlite for test which closes db foreign keys
function by default. This patch enabled the sqlite foreign keys
function for unit test by default.

The "project" table is a self referencing FK table(id <-> domain_id
column). So when the FK is enabled, there must exists a root record
before insert data to this table. It's <<keystone.domain.root>>.

Usually, the <<keystone.domain.root>> recored is inserted into the
table once operators run "keystone-manage db_sync" command when
deploy Keystone. But the unit test code doesn't run this command,
it initialise the db schema by reading sqlalchemy object model, so
the <<keystone.domain.root>> record is missed. Then we can't create
any project record, it'll raise FK error.

So in this patch, before creating any projects in the test, we must
ensure the <<keystone.domain.root>> record exists first.

Change-Id: I565d12395ca39a58ba90faf8641a9e02d986aeb9
Closes-Bug: #1744195
2018-10-09 09:50:21 +08:00
..
application_credential Add cache invalidation when delete application credential 2018-02-05 14:09:07 +08:00
assignment Added support for a ``description`` attribute for Identity Roles 2018-09-06 05:09:10 +00:00
auth Move validate_issue_token_auth from controllers 2018-08-01 16:57:16 +00:00
backend Finish refactoring self.*_api out of tests 2018-02-05 23:26:08 +00:00
catalog Finish refactoring self.*_api out of tests 2018-02-05 23:26:08 +00:00
common Add build_target arguement to enforcer 2018-09-28 15:50:44 -05:00
config_files Remove LDAP write support 2017-01-21 21:32:07 -05:00
contrib Added check to avoid keyerror "user['name']" 2018-06-28 09:52:18 +05:30
credential Revert "Rename fernet_utils to token_utils" 2018-06-06 16:49:27 +12:00
endpoint_policy Fixes remaining nits in endpoint_policy tests 2016-11-15 20:03:47 +00:00
external Replace parse_strtime with datetime.strptime 2017-12-21 12:14:28 -06:00
federation Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
identity Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
ksfixtures Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
limit Delete project limits when deleting project 2018-07-19 03:49:45 +00:00
policy Finish refactoring self.*_api out of tests 2018-02-05 23:26:08 +00:00
resource Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
saml2 Add openstack_user_domain to assertion 2015-05-04 14:33:48 -03:00
server Properly replace flask view args in links 2018-09-28 13:42:24 -07:00
tests Adds a skip method to identify useless skips 2016-06-29 19:48:12 +00:00
token Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
trust Purge soft-deleted trusts 2018-10-02 09:49:53 +05:30
__init__.py enable ldap tests for py3 2016-05-18 12:07:23 -04:00
base_classes.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
core.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
default_catalog.templates Remove/update v2 catalog endpoint tests 2017-10-21 16:45:12 -05:00
default_catalog_multi_region.templates Fixing multi-region support in templated v3 catalog 2018-03-13 11:10:08 -07:00
default_fixtures.py Force SQLite to properly deal with foreign keys 2018-02-14 16:54:15 +00:00
fakeldap.py Add a hacking rule for string interpolation at logging 2017-07-18 14:11:28 +08:00
federation_fixtures.py Move existing tests to unit 2015-02-13 15:54:29 -06:00
filtering.py Finish refactoring self.*_api out of tests 2018-02-05 23:26:08 +00:00
identity_mapping.py Use the new enginefacade from oslo.db 2016-02-24 08:20:12 -08:00
mapping_fixtures.py Update test case for federation 2017-05-19 10:54:15 +08:00
rest.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_associate_project_endpoint_extension.py Refactor self.*_api out of tests 2018-02-03 00:14:40 +00:00
test_auth_plugin.py Clean up token extra code 2018-08-02 11:52:10 +08:00
test_backend_endpoint_policy.py Finish refactoring self.*_api out of tests 2018-02-05 23:26:08 +00:00
test_backend_endpoint_policy_sql.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_backend_federation_sql.py Require domain_id when registering Identity Providers 2017-01-06 16:05:12 +00:00
test_backend_id_mapping_sql.py Increase test coverage of entity_type id mapping query 2018-07-13 21:42:07 +00:00
test_backend_ldap.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_backend_ldap_pool.py Refactor self.*_api out of tests 2018-02-03 00:14:40 +00:00
test_backend_rules.py Split policy backend tests 2016-03-04 15:32:42 -03:00
test_backend_sql.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_backend_templated.py Fixing multi-region support in templated v3 catalog 2018-03-13 11:10:08 -07:00
test_cli.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_config.py Remove pastedeploy 2018-06-06 19:30:26 +00:00
test_contrib_ec2_core.py Remove the rest of v2.0 legacy 2018-06-06 19:30:14 +00:00
test_contrib_s3_core.py Finish refactoring self.*_api out of tests 2018-02-05 23:26:08 +00:00
test_contrib_simple_cert.py Ensure HEAD is supported with simple cert 2017-06-13 16:03:38 +00:00
test_driver_hints.py Use assertTrue/False instead of assertEqual(T/F) 2015-11-02 09:10:38 +00:00
test_entry_points.py Remove pastedeploy 2018-06-06 19:30:26 +00:00
test_exception.py Remove log translations in keystone 2017-03-25 18:17:15 +00:00
test_hacking_checks.py Remove duplicated hacking rule 2017-06-28 07:48:03 +00:00
test_ldap_livetest.py Refactor self.*_api out of tests 2018-02-03 00:14:40 +00:00
test_ldap_pool_livetest.py Finish refactoring self.*_api out of tests 2018-02-05 23:26:08 +00:00
test_ldap_tls_livetest.py Refactor self.*_api out of tests 2018-02-03 00:14:40 +00:00
test_limits.py Do not allow create limits for domain 2018-08-03 15:33:44 +08:00
test_middleware.py Remove the TokenAuth middleware 2018-05-10 14:40:39 +00:00
test_policy.py Implement base for new RBAC Enforcer 2018-06-27 22:38:06 +00:00
test_revoke.py Remove unused revoke_by_user_and_project 2018-09-14 04:08:01 +00:00
test_shadow_users.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_sql_banned_operations.py Work around deprecations for opportunistic tests 2018-02-27 13:46:27 +00:00
test_sql_upgrade.py Added support for a ``description`` attribute for Identity Roles 2018-09-06 05:09:10 +00:00
test_token_provider.py Cleanup keystone.token.providers.common 2018-07-13 14:49:07 +00:00
test_url_middleware.py Change url in middleware test to v3 2017-11-01 05:09:27 +00:00
test_v3.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_v3_application_credential.py Add application credential auth plugin 2018-01-27 12:00:19 +01:00
test_v3_assignment.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_v3_auth.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_v3_catalog.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_v3_credential.py Remove enable config option of trust feature 2018-07-09 16:13:55 +08:00
test_v3_domain_config.py Finish refactoring self.*_api out of tests 2018-02-05 23:26:08 +00:00
test_v3_endpoint_policy.py Refactor self.*_api out of tests 2018-02-03 00:14:40 +00:00
test_v3_federation.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_v3_filters.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_v3_identity.py Allow blocking users from self-service password change 2018-04-18 19:15:07 +00:00
test_v3_oauth1.py Convert OS-AUTH1 paths to flask dispatching 2018-08-02 15:11:58 -07:00
test_v3_os_revoke.py Refactor self.*_api out of tests 2018-02-03 00:14:40 +00:00
test_v3_policy.py Refactor self.*_api out of tests 2018-02-03 00:14:40 +00:00
test_v3_protection.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_v3_resource.py Enable foreign keys for unit test 2018-10-09 09:50:21 +08:00
test_v3_trust.py Implement "no-update" test for trusts 2018-07-26 10:30:24 -07:00
test_validation.py Added support for a ``description`` attribute for Identity Roles 2018-09-06 05:09:10 +00:00
test_versions.py Convert OS-FEDERATION to flask native dispatching 2018-09-10 11:22:58 -07:00
test_wsgi.py Keystone adheres to public_endpoint opt only 2018-06-27 09:58:35 -07:00
utils.py Add new functionality to @wip 2016-05-22 16:06:50 +00:00