'Test ec2 credential listing.'

def test_ec2_list_credentials(self):

    self._get_ec2_cred()
    uri = self._get_ec2_cred_uri()
    r = self.get(uri)
    cred_list = r.result['credentials']
    self.assertEqual(1, len(cred_list))
    self.assertThat(r.result['links']['self'], matchers.EndsWith(uri))
    non_ec2_cred = unit.new_credential_ref(user_id=self.user_id, project_id=self.project_id)
    non_ec2_cred['type'] = uuid.uuid4().hex
    self.credential_api.create_credential(non_ec2_cred['id'], non_ec2_cred)
    r = self.get(uri)
    cred_list_2 = r.result['credentials']
    self.assertEqual(1, len(cred_list_2))
    self.assertEqual(cred_list[0], cred_list_2[0])
