"test_project_get_equals_list" allows extra fields
Keystone is updating the project response to include resource-specific options. The test `test_project_get_equals_list` is looking at explicit data being returned and prevents the additional field. Keystone does not (and currently has not plan) to support microversions. This changes the test checking the returned fields to ensure that the expected fields is a subset (inclusive) of the returned fields. This allows for Keystone to iterate and respond with additional fields for future changes. Any future fields added become part of the contract and should be added to the expected "fields" list in the test after the new field response code lands within keystone. Related-Bug: #1807751 Required-by: https://review.opendev.org/#/c/678322/ Change-Id: I266d98503066f3a8027effc43a95f9ad9ff12492
This commit is contained in:
parent
e535cb5124
commit
8641a70736
|
@ -230,8 +230,14 @@ class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
|
|||
_projects = self.projects_client.list_projects()['projects']
|
||||
project_list = next(x for x in _projects if x['id'] == project['id'])
|
||||
|
||||
# Assert the list of fields is correct (one is enough to check here)
|
||||
self.assertSetEqual(set(fields), set(project_get.keys()))
|
||||
# Assert the expected fields exist. More fields than expected may
|
||||
# be in this list. This is for future proofind as keystone does not
|
||||
# and has no plans to support microservices. Any fields in the future
|
||||
# that are added to the response of the API should eventually be added
|
||||
# to the expected fields. The expected fields must be a subset of
|
||||
# the project_get fields (all keys in fields must exist in project_get,
|
||||
# but project_get.keys() may have additional fields)
|
||||
self.assertTrue(set(fields).issubset(project_get.keys()))
|
||||
|
||||
# Ensure the set of tags is identical and match the expected one
|
||||
get_tags = set(project_get.pop("tags"))
|
||||
|
|
Loading…
Reference in New Issue