Beispiel #1
0
    def deserialize(cls, xml_node):
        """Deserializes the contact information section in response.

        :param xml_node: XML node to be parsed. Expected to explicitly be
        Contact Information XML node.
        :return: parsed contact information response.
        """
        contact = ContactInfo()
        contact.first_name = utils.get_element_text(
            xml_node.find('.//m:FirstName', utils.NS)
        )
        contact.last_name = utils.get_element_text(
            xml_node.find('.//m:LastName', utils. NS)
        )
        contact.phone = utils.get_element_text(
            xml_node.find('.//m:Phone', utils.NS)
        )
        contact.email = utils.get_element_text(
            xml_node.find('.//m:Email', utils.NS)
        )
        contact.title = utils.get_element_text(
            xml_node.find('.//m:Title', utils. NS)
        )

        return contact
Beispiel #2
0
    def deserialize(cls, xml_node):
        order_response = OrderResponseHeader()
        order_response.partner_order_id = utils.get_element_text(
            xml_node.find('.//m:PartnerOrderID', utils.ONS)
        )
        order_response.success_code = utils.get_element_text(
            xml_node.find('.//m:SuccessCode', utils.ONS)
        )
        order_response.timestamp = utils.get_element_text(
            xml_node.find('.//m:Timestamp', utils.ONS)
        )

        return order_response
Beispiel #3
0
    def deserialize(cls, xml_node):
        result = QuickOrderResult()
        result.order_id = utils.get_element_text(
            xml_node.find('.//m:GeoTrustOrderID', utils.ONS)
        )
        result.order_response = OrderResponseHeader.deserialize(xml_node)

        return result
Beispiel #4
0
    def deserialize(cls, xml_node):
        """ Deserializes the vulnerability section in the response.

        :param xml_node: XML node to be parsed. Expected to explicitly be
        Vulnerability XML node.
        :return: parsed vulnerability response.
        """
        vuln = Vulnerability()

        vuln.mod_id = utils.get_element_text(
            xml_node.find('.//m:Severity', utils.NS)
        )
        vuln.event_name = utils.get_element_text(
            xml_node.find('.//m:NumberFound', utils.NS)
        )

        return vuln
Beispiel #5
0
    def deserialize(cls, xml_node):
        """Deserializes the intermediate certificates section in the response.

        :param xml_node: XML node to be parsed. Expected to explicitly be
        Intermediate Certificate XML node.
        :return: parsed intermediate certificate response.
        """

        inter_info = IntermediateCertificate()
        inter_info.type = utils.get_element_text(
            xml_node.find('.//m:Type', utils.NS)
        )
        inter_info.cert = utils.get_element_text(
            xml_node.find('.//m:CACert', utils.NS)
        )

        return inter_info
Beispiel #6
0
    def deserialize(cls, xml_node):
        """Deserializes the order detail section in response.

        :param xml_node: XML node to be parsed. Expected to explicitly be
        Order Detail XML node.
        :return: parsed order detail response.
        """
        od = OrderDetail()

        od.status_code = utils.get_element_text(
            xml_node.find('.//m:OrderStatusMinorCode', utils.NS)
        )
        od.status_name = utils.get_element_text(
            xml_node.find('.//m:OrderStatusMinorName', utils.NS)
        )
        od.approver_email = utils.get_element_text(
            xml_node.find('.//m:ApproverEmailAddress', utils.NS)
        )

        # Deserialize Child nodes
        org_info_node = xml_node.find('.//m:OrganizationInfo', utils.NS)
        org_contacts_node = xml_node.find('.//m:OrderContacts', utils.NS)
        od.organization_info = OrganizationInfo.deserialize(org_info_node)
        od.organization_contacts = OrderContacts.deserialize(org_contacts_node)

        mod_events_node = xml_node.find('.//m:ModificationEvents', utils.NS)
        if mod_events_node is not None:
            od.modified_events = (
                ModificationEvents.deserialize(mod_events_node)
            )

        vulnerability_node = xml_node.find('.//m:Vulnerabilities', utils.NS)
        if vulnerability_node is not None:
            od.vulnerabilities = (
                Vulnerabilities.deserialize(vulnerability_node)
            )

        fulfillment_node = xml_node.find('.//m:Fulfillment', utils.NS)
        if fulfillment_node is not None:
            od.certificates = Certificate.deserialize(fulfillment_node)

        return od
Beispiel #7
0
    def deserialize(cls, xml_node):
        """ Deserializes the modification event section in the response.

        :param xml_node: XML node to be parsed. Expected to explicitly be
        Modification Event XML node.
        :return: parsed modification event response.
        """
        me = ModificationEvent()

        me.mod_id = utils.get_element_text(
            xml_node.find('.//m:ModificationEventID', utils.NS)
        )
        me.event_name = utils.get_element_text(
            xml_node.find('.//m:ModificationEventName', utils.NS)
        )
        me.time_stamp = utils.get_element_text(
            xml_node.find('.//m:ModificationTimestamp', utils.NS)
        )

        return me
Beispiel #8
0
    def deserialize(cls, xml_node):
        """Deserializes the contact information section in response.

        :param xml_node: XML node to be parsed. Expected to explicitly be
        Contact Information XML node.
        :return: parsed contact information response.
        """
        contact = ContactInfo()
        contact.first_name = utils.get_element_text(
            xml_node.find('.//m:FirstName', utils.NS))
        contact.last_name = utils.get_element_text(
            xml_node.find('.//m:LastName', utils.NS))
        contact.phone = utils.get_element_text(
            xml_node.find('.//m:Phone', utils.NS))
        contact.email = utils.get_element_text(
            xml_node.find('.//m:Email', utils.NS))
        contact.title = utils.get_element_text(
            xml_node.find('.//m:Title', utils.NS))

        return contact
Beispiel #9
0
    def deserialize(cls, xml_node):
        """Deserializes the organization information section in response.

        :param xml_node: XML node to be parsed. Expected to explicitly be
        Organization Information XML node.
        :return: parsed organization information response.
        """
        org_info = OrganizationInfo()
        org_info.name = utils.get_element_text(
            xml_node.find('.//m:OrganizationName', utils.NS)
        )
        org_info.city = utils.get_element_text(
            xml_node.find('.//m:City', utils.NS)
        )
        org_info.region = utils.get_element_text(
            xml_node.find('.//m:Region', utils.NS)
        )
        org_info.country = utils.get_element_text(
            xml_node.find('.//m:Country', utils.NS)
        )

        return org_info
Beispiel #10
0
    def deserialize(cls, xml_node):
        """Deserializes the certificate information section in the response.

        :param xml_node: XML node to be parsed. Expected to explicitly be
        Certificate Information XML node.
        :return: parsed certificate information response.
        """
        cert_info = CertificateInfo()
        cert_info.common_name = utils.get_element_text(
            xml_node.find('.//m:CommonName', utils.NS)
        )
        cert_info.status = utils.get_element_text(
            xml_node.find('.//m:CertificateStatus', utils.NS)
        )
        cert_info.hash_algorithm = utils.get_element_text(
            xml_node.find('.//m:SignatureHashAlgorithm', utils.NS)
        )
        cert_info.encryption_algorithm = utils.get_element_text(
            xml_node.find('.//m:SignatureEncryptionAlgorithm', utils.NS)
        )

        return cert_info
Beispiel #11
0
    def deserialize(cls, xml_node):
        """Deserializes the certificate section in the response.

        :param xml_node:XML node to be parsed. Expected to explicitly be
        Certificates XML node.
        :return: parsed certificate response.
        """
        cert = Certificate()
        cert.server_cert = utils.get_element_text(
            xml_node.find('.//m:ServerCertificate', utils.NS)
        )
        ca_certs = xml_node.find('.//m:CACertificates', utils.NS)

        for x in ca_certs:
            cert.intermediates.append(IntermediateCertificate.deserialize(x))

        return cert
    def test_get_element_text_with_none_type(self):
        element = None
        text = utils.get_element_text(element)

        assert text == "None"
Beispiel #13
0
    def test_get_element_text_with_none_type(self):
        element = None
        text = utils.get_element_text(element)

        assert text == "None"