'Call ``GET  /credentials?type={type}``.'

def test_list_credentials_filtered_by_type(self):

    ec2_credential = unit.new_credential_ref(user_id=uuid.uuid4().hex, project_id=self.project_id, type=CRED_TYPE_EC2)
    ec2_resp = self.credential_api.create_credential(ec2_credential['id'], ec2_credential)
    r = self.get('/credentials?type=cert')
    self.assertValidCredentialListResponse(r, ref=self.credential)
    for cred in r.result['credentials']:
        self.assertEqual('cert', cred['type'])
    r_ec2 = self.get('/credentials?type=ec2')
    self.assertThat(r_ec2.result['credentials'], matchers.HasLength(1))
    cred_ec2 = r_ec2.result['credentials'][0]
    self.assertValidCredentialListResponse(r_ec2, ref=ec2_resp)
    self.assertEqual(CRED_TYPE_EC2, cred_ec2['type'])
    self.assertEqual(ec2_credential['id'], cred_ec2['id'])
