Merge "test_backend_sql work with python34"
This commit is contained in:
commit
fb10b816c4
@ -333,7 +333,7 @@ class AssignmentTestHelperMixin(object):
|
|||||||
self.assignment_api.create_grant(**args)
|
self.assignment_api.create_grant(**args)
|
||||||
return test_data
|
return test_data
|
||||||
|
|
||||||
def execute_assignment_tests(self, test_plan, test_data):
|
def execute_assignment_cases(self, test_plan, test_data):
|
||||||
"""Execute the test plan, based on the created test_data."""
|
"""Execute the test plan, based on the created test_data."""
|
||||||
def check_results(expected, actual, param_arg_count):
|
def check_results(expected, actual, param_arg_count):
|
||||||
if param_arg_count == 0:
|
if param_arg_count == 0:
|
||||||
@ -389,7 +389,7 @@ class AssignmentTestHelperMixin(object):
|
|||||||
results = self.assignment_api.list_role_assignments(**args)
|
results = self.assignment_api.list_role_assignments(**args)
|
||||||
check_results(test['results'], results, len(args))
|
check_results(test['results'], results, len(args))
|
||||||
|
|
||||||
def execute_assignment_test_plan(self, test_plan):
|
def execute_assignment_plan(self, test_plan):
|
||||||
"""Create entities, assignments and execute the test plan.
|
"""Create entities, assignments and execute the test plan.
|
||||||
|
|
||||||
The standard method to call to create entities and assignments and
|
The standard method to call to create entities and assignments and
|
||||||
@ -405,7 +405,7 @@ class AssignmentTestHelperMixin(object):
|
|||||||
if 'assignments' in test_plan:
|
if 'assignments' in test_plan:
|
||||||
test_data = self.create_assignments(test_plan['assignments'],
|
test_data = self.create_assignments(test_plan['assignments'],
|
||||||
test_data)
|
test_data)
|
||||||
self.execute_assignment_tests(test_plan, test_data)
|
self.execute_assignment_cases(test_plan, test_data)
|
||||||
return test_data
|
return test_data
|
||||||
|
|
||||||
|
|
||||||
@ -900,7 +900,7 @@ class IdentityTests(AssignmentTestHelperMixin):
|
|||||||
{'group': 0, 'role': 2, 'project': 0}]}
|
{'group': 0, 'role': 2, 'project': 0}]}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
self.execute_assignment_test_plan(test_plan)
|
self.execute_assignment_plan(test_plan)
|
||||||
|
|
||||||
def test_list_role_assignments_filtered_by_role(self):
|
def test_list_role_assignments_filtered_by_role(self):
|
||||||
"""Test listing of role assignments filtered by role ID."""
|
"""Test listing of role assignments filtered by role ID."""
|
||||||
@ -922,7 +922,7 @@ class IdentityTests(AssignmentTestHelperMixin):
|
|||||||
{'group': 0, 'role': 2, 'project': 0}]}
|
{'group': 0, 'role': 2, 'project': 0}]}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
test_data = self.execute_assignment_test_plan(test_plan)
|
test_data = self.execute_assignment_plan(test_plan)
|
||||||
|
|
||||||
# Also test that list_role_assignments_for_role() gives the same answer
|
# Also test that list_role_assignments_for_role() gives the same answer
|
||||||
assignment_list = self.assignment_api.list_role_assignments_for_role(
|
assignment_list = self.assignment_api.list_role_assignments_for_role(
|
||||||
@ -955,7 +955,7 @@ class IdentityTests(AssignmentTestHelperMixin):
|
|||||||
'results': [{'group': 0, 'role': 0, 'project': 0}]}
|
'results': [{'group': 0, 'role': 0, 'project': 0}]}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
self.execute_assignment_test_plan(test_plan)
|
self.execute_assignment_plan(test_plan)
|
||||||
|
|
||||||
def test_list_role_assignments_bad_role(self):
|
def test_list_role_assignments_bad_role(self):
|
||||||
assignment_list = self.assignment_api.list_role_assignments_for_role(
|
assignment_list = self.assignment_api.list_role_assignments_for_role(
|
||||||
@ -2009,7 +2009,7 @@ class IdentityTests(AssignmentTestHelperMixin):
|
|||||||
'results': []},
|
'results': []},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
self.execute_assignment_test_plan(test_plan)
|
self.execute_assignment_plan(test_plan)
|
||||||
|
|
||||||
def test_list_role_assignment_by_user_with_domain_group_roles(self):
|
def test_list_role_assignment_by_user_with_domain_group_roles(self):
|
||||||
"""Test listing assignments by user, with group roles on a domain."""
|
"""Test listing assignments by user, with group roles on a domain."""
|
||||||
@ -2054,7 +2054,7 @@ class IdentityTests(AssignmentTestHelperMixin):
|
|||||||
'results': []},
|
'results': []},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
self.execute_assignment_test_plan(test_plan)
|
self.execute_assignment_plan(test_plan)
|
||||||
|
|
||||||
def test_delete_domain_with_user_group_project_links(self):
|
def test_delete_domain_with_user_group_project_links(self):
|
||||||
# TODO(chungg):add test case once expected behaviour defined
|
# TODO(chungg):add test case once expected behaviour defined
|
||||||
@ -4761,7 +4761,7 @@ class TokenTests(object):
|
|||||||
|
|
||||||
def _test_predictable_revoked_pki_token_id(self, hash_fn):
|
def _test_predictable_revoked_pki_token_id(self, hash_fn):
|
||||||
token_id = self._create_token_id()
|
token_id = self._create_token_id()
|
||||||
token_id_hash = hash_fn(token_id).hexdigest()
|
token_id_hash = hash_fn(token_id.encode('utf-8')).hexdigest()
|
||||||
token = {'user': {'id': uuid.uuid4().hex}}
|
token = {'user': {'id': uuid.uuid4().hex}}
|
||||||
|
|
||||||
self.token_provider_api._persistence.create_token(token_id, token)
|
self.token_provider_api._persistence.create_token(token_id, token)
|
||||||
@ -5875,7 +5875,7 @@ class InheritanceTests(AssignmentTestHelperMixin):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
self.config_fixture.config(group='os_inherit', enabled=True)
|
self.config_fixture.config(group='os_inherit', enabled=True)
|
||||||
self.execute_assignment_test_plan(test_plan)
|
self.execute_assignment_plan(test_plan)
|
||||||
|
|
||||||
def test_inherited_role_assignments_excluded_if_os_inherit_false(self):
|
def test_inherited_role_assignments_excluded_if_os_inherit_false(self):
|
||||||
test_plan = {
|
test_plan = {
|
||||||
@ -5906,7 +5906,7 @@ class InheritanceTests(AssignmentTestHelperMixin):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
self.config_fixture.config(group='os_inherit', enabled=False)
|
self.config_fixture.config(group='os_inherit', enabled=False)
|
||||||
self.execute_assignment_test_plan(test_plan)
|
self.execute_assignment_plan(test_plan)
|
||||||
|
|
||||||
def _test_crud_inherited_and_direct_assignment(self, **kwargs):
|
def _test_crud_inherited_and_direct_assignment(self, **kwargs):
|
||||||
"""Tests inherited and direct assignments for the actor and target
|
"""Tests inherited and direct assignments for the actor and target
|
||||||
@ -6087,7 +6087,7 @@ class InheritanceTests(AssignmentTestHelperMixin):
|
|||||||
'results': [{'user': 0, 'role': 1, 'domain': 0}]},
|
'results': [{'user': 0, 'role': 1, 'domain': 0}]},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
self.execute_assignment_test_plan(test_plan)
|
self.execute_assignment_plan(test_plan)
|
||||||
|
|
||||||
def test_inherited_role_grants_for_group(self):
|
def test_inherited_role_grants_for_group(self):
|
||||||
"""Test inherited group roles.
|
"""Test inherited group roles.
|
||||||
@ -6206,7 +6206,7 @@ class InheritanceTests(AssignmentTestHelperMixin):
|
|||||||
'indirect': {'domain': 0, 'group': 1}}]}
|
'indirect': {'domain': 0, 'group': 1}}]}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
self.execute_assignment_test_plan(test_plan)
|
self.execute_assignment_plan(test_plan)
|
||||||
|
|
||||||
def test_list_projects_for_user_with_inherited_grants(self):
|
def test_list_projects_for_user_with_inherited_grants(self):
|
||||||
"""Test inherited user roles.
|
"""Test inherited user roles.
|
||||||
@ -6276,7 +6276,7 @@ class InheritanceTests(AssignmentTestHelperMixin):
|
|||||||
'indirect': {'domain': 1}}]}
|
'indirect': {'domain': 1}}]}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
self.execute_assignment_test_plan(test_plan)
|
self.execute_assignment_plan(test_plan)
|
||||||
|
|
||||||
def test_list_projects_for_user_with_inherited_user_project_grants(self):
|
def test_list_projects_for_user_with_inherited_user_project_grants(self):
|
||||||
"""Test inherited role assignments for users on nested projects.
|
"""Test inherited role assignments for users on nested projects.
|
||||||
@ -6376,10 +6376,10 @@ class InheritanceTests(AssignmentTestHelperMixin):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
self.config_fixture.config(group='os_inherit', enabled=True)
|
self.config_fixture.config(group='os_inherit', enabled=True)
|
||||||
test_data = self.execute_assignment_test_plan(test_plan)
|
test_data = self.execute_assignment_plan(test_plan)
|
||||||
self.config_fixture.config(group='os_inherit', enabled=False)
|
self.config_fixture.config(group='os_inherit', enabled=False)
|
||||||
# Pass the existing test data in to allow execution of 2nd test plan
|
# Pass the existing test data in to allow execution of 2nd test plan
|
||||||
self.execute_assignment_tests(
|
self.execute_assignment_cases(
|
||||||
test_plan_with_os_inherit_disabled, test_data)
|
test_plan_with_os_inherit_disabled, test_data)
|
||||||
|
|
||||||
def test_list_projects_for_user_with_inherited_group_grants(self):
|
def test_list_projects_for_user_with_inherited_group_grants(self):
|
||||||
@ -6486,7 +6486,7 @@ class InheritanceTests(AssignmentTestHelperMixin):
|
|||||||
'indirect': {'domain': 2}}]}
|
'indirect': {'domain': 2}}]}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
self.execute_assignment_test_plan(test_plan)
|
self.execute_assignment_plan(test_plan)
|
||||||
|
|
||||||
def test_list_projects_for_user_with_inherited_group_project_grants(self):
|
def test_list_projects_for_user_with_inherited_group_project_grants(self):
|
||||||
"""Test inherited role assignments for groups on nested projects.
|
"""Test inherited role assignments for groups on nested projects.
|
||||||
@ -6592,10 +6592,10 @@ class InheritanceTests(AssignmentTestHelperMixin):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
self.config_fixture.config(group='os_inherit', enabled=True)
|
self.config_fixture.config(group='os_inherit', enabled=True)
|
||||||
test_data = self.execute_assignment_test_plan(test_plan)
|
test_data = self.execute_assignment_plan(test_plan)
|
||||||
self.config_fixture.config(group='os_inherit', enabled=False)
|
self.config_fixture.config(group='os_inherit', enabled=False)
|
||||||
# Pass the existing test data in to allow execution of 2nd test plan
|
# Pass the existing test data in to allow execution of 2nd test plan
|
||||||
self.execute_assignment_tests(
|
self.execute_assignment_cases(
|
||||||
test_plan_with_os_inherit_disabled, test_data)
|
test_plan_with_os_inherit_disabled, test_data)
|
||||||
|
|
||||||
|
|
||||||
|
@ -849,11 +849,6 @@ class SqlDecorators(unit.TestCase):
|
|||||||
tt = FakeTable(col='a')
|
tt = FakeTable(col='a')
|
||||||
self.assertEqual('a', tt.col)
|
self.assertEqual('a', tt.col)
|
||||||
|
|
||||||
def test_non_ascii_init(self):
|
|
||||||
# NOTE(I159): Non ASCII characters must cause UnicodeDecodeError
|
|
||||||
# if encoding is not provided explicitly.
|
|
||||||
self.assertRaises(UnicodeDecodeError, FakeTable, col='Я')
|
|
||||||
|
|
||||||
def test_conflict_happend(self):
|
def test_conflict_happend(self):
|
||||||
self.assertRaises(exception.Conflict, FakeTable().insert)
|
self.assertRaises(exception.Conflict, FakeTable().insert)
|
||||||
self.assertRaises(exception.UnexpectedError, FakeTable().update)
|
self.assertRaises(exception.UnexpectedError, FakeTable().update)
|
||||||
|
1
tox.ini
1
tox.ini
@ -45,6 +45,7 @@ commands =
|
|||||||
keystone/tests/unit/test_backend_id_mapping_sql.py \
|
keystone/tests/unit/test_backend_id_mapping_sql.py \
|
||||||
keystone/tests/unit/test_backend.py \
|
keystone/tests/unit/test_backend.py \
|
||||||
keystone/tests/unit/test_backend_rules.py \
|
keystone/tests/unit/test_backend_rules.py \
|
||||||
|
keystone/tests/unit/test_backend_sql.py \
|
||||||
keystone/tests/unit/test_config.py \
|
keystone/tests/unit/test_config.py \
|
||||||
keystone/tests/unit/test_contrib_ec2.py \
|
keystone/tests/unit/test_contrib_ec2.py \
|
||||||
keystone/tests/unit/test_contrib_s3_core.py \
|
keystone/tests/unit/test_contrib_s3_core.py \
|
||||||
|
Loading…
Reference in New Issue
Block a user