Merge "Fix Upstream test cases to be case insensitive"
diff --git a/tempest/api/identity/v3/test_tokens.py b/tempest/api/identity/v3/test_tokens.py
index f13aa10..fa1c47f 100644
--- a/tempest/api/identity/v3/test_tokens.py
+++ b/tempest/api/identity/v3/test_tokens.py
@@ -43,7 +43,15 @@
         self.assertEqual(authenticated_token, token_body)
         # test to see if token has been properly authenticated
         self.assertEqual(authenticated_token['user']['id'], user_id)
-        self.assertEqual(authenticated_token['user']['name'], username)
+        # NOTE: resource name that are case-sensitive in keystone
+        # depends on backends such as MySQL or LDAP which are
+        # case-insensitive, case-preserving. Resource name is
+        # returned as it is stored in the backend, not as it is
+        # requested. Verifying the username with both lower-case to
+        # avoid failure on different backends
+        self.assertEqual(
+            authenticated_token['user']['name'].lower(), username.lower())
+
         self.non_admin_client.delete_token(subject_token)
         self.assertRaises(
             lib_exc.NotFound, self.non_admin_client.show_token, subject_token)
@@ -84,10 +92,17 @@
             self.assertIsNotNone(subject_id, 'Expected user ID in token.')
 
         subject_name = resp['user']['name']
+
         if username:
-            self.assertEqual(subject_name, username)
+            # NOTE: resource name that are case-sensitive in keystone
+            # depends on backends such as MySQL or LDAP which are
+            # case-insensitive, case-preserving. Resource name is
+            # returned as it is stored in the backend, not as it is
+            # requested. Verifying the username with both lower-case to
+            # avoid failure on different backends
+            self.assertEqual(subject_name.lower(), username.lower())
         else:
-            # Expect a user name, but don't know what it will be.
+            # Expect a user name, but don't know what it will be
             self.assertIsNotNone(subject_name, 'Expected user name in token.')
 
         self.assertEqual(resp['methods'][0], 'password')
@@ -110,7 +125,15 @@
             subject_token)['token']
         self.assertEqual(resp['x-subject-token'], subject_token)
         self.assertEqual(token_details['user']['id'], user.user_id)
-        self.assertEqual(token_details['user']['name'], user.username)
+        # NOTE: resource name that are case-sensitive in keystone
+        # depends on backends such as MySQL or LDAP which are
+        # case-insensitive, case-preserving. Resource name is
+        # returned as it is stored in the backend, not as it is
+        # requested. Verifying the username with both lower-case to
+        # avoid failure on different backends
+        self.assertEqual(
+            token_details['user']['name'].lower(),
+            user.username.lower())
         # Perform Delete Token
         self.non_admin_client.delete_token(subject_token)
         self.assertRaises(lib_exc.NotFound,