'Get the list of user ec2 credentials.'

@decorators.idempotent_id('9e2ea42f-0a4f-468c-a768-51859ce492e0')
def test_list_ec2_credentials(self):

    created_creds = []
    creds1 = self.non_admin_users_client.create_user_ec2_credential(self.creds.user_id, tenant_id=self.creds.tenant_id)['credential']
    created_creds.append(creds1['access'])
    creds2 = self.non_admin_users_client.create_user_ec2_credential(self.creds.user_id, tenant_id=self.creds.tenant_id)['credential']
    created_creds.append(creds2['access'])
    self.addCleanup(self.non_admin_users_client.delete_user_ec2_credential, self.creds.user_id, creds1['access'])
    self.addCleanup(self.non_admin_users_client.delete_user_ec2_credential, self.creds.user_id, creds2['access'])
    resp = self.non_admin_users_client.list_user_ec2_credentials(self.creds.user_id)['credentials']
    fetched_creds = [cred['access'] for cred in resp]
    missing = [cred for cred in created_creds if (cred not in fetched_creds)]
    self.assertEmpty(missing, ('Failed    to    find    ec2_credentials    %s    in    fetched    list' % ',    '.join((cred for cred in missing))))
