'Fetch and parse the metadata XML at self.METADATA_URL'

def _fetch_metadata(self):

    response = self.client.get(self.METADATA_URL)
    self.assertEqual(response.status_code, 200)
    self.assertEqual(response['Content-Type'], 'text/xml')
    try:
        metadata_doc = etree.fromstring(response.content)
    except etree.LxmlError:
        self.fail('SAML    metadata    must    be    valid    XML')
    self.assertEqual(metadata_doc.tag, etree.QName(SAML_XML_NS, 'EntityDescriptor'))
    return metadata_doc
