Sort roles in keystone token
Closes-bug: 1879359 https://bugs.launchpad.net/tempest/+bug/1879359 Sorts the roles in the scoped tokens so that the test case does not fail Change-Id: Iac94eab78035a9b0f3926bd7da237ae4f5fb68d8
This commit is contained in:
parent
385873e65d
commit
706723954d
|
@ -13,6 +13,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import operator
|
||||
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
|
@ -40,6 +42,15 @@ class TokensV3Test(base.BaseIdentityV3Test):
|
|||
authenticated_token = self.non_admin_client.show_token(
|
||||
subject_token)['token']
|
||||
# sanity checking to make sure they are indeed the same token
|
||||
# If there are roles in the token, sort the roles
|
||||
authenticated_token_roles = authenticated_token.get("roles")
|
||||
if authenticated_token_roles:
|
||||
authenticated_token["roles"] = authenticated_token_roles.sort(
|
||||
key=operator.itemgetter('id'))
|
||||
token_body_roles = token_body.get("roles")
|
||||
if token_body_roles:
|
||||
token_body["roles"] = token_body_roles.sort(
|
||||
key=operator.itemgetter('id'))
|
||||
self.assertEqual(authenticated_token, token_body)
|
||||
# test to see if token has been properly authenticated
|
||||
self.assertEqual(authenticated_token['user']['id'], user_id)
|
||||
|
|
Loading…
Reference in New Issue