Unlike "normal" unauthenticated /auth/tokens requests, these unit tests are authenticated. This causes initiator.id to have a unit-testable value, which causes "self.assertEqual(initiator.name, user_id)" to succeed in those tests.
This succeeds because, coincidentally, the user ID in the authentication request matches the authenticating user ID.
I think the confusion may ultimately come from the original unit tests introduced in https:/ /opendev. org/openstack/ keystone/ commit/ b2b341f4700554e be7c35307916df0 67cfeb61ff
Unlike "normal" unauthenticated /auth/tokens requests, these unit tests are authenticated. This causes initiator.id to have a unit-testable value, which causes "self.assertEqu al(initiator. name, user_id)" to succeed in those tests.
This succeeds because, coincidentally, the user ID in the authentication request matches the authenticating user ID.
This was not mentioned https:/ /bugs.launchpad .net/keystone/ +bug/1780503 , so I suspect the author may not have been aware of this detail.