Создание тестовых примеров на Python из WSDL

#python #unit-testing #soap #wsdl

#python #модульное тестирование #soap #wsdl

Вопрос:

у меня есть клиент python на основе suds, который получает методы веб-сервисов, такие как:

 Service ( serviceService ) tns="urn:service"
   Prefixes (0)
   Ports (1):
      (EbrevSubscriptionServicePort)
         Methods (14):
            authenticate(xs:integer authId, xs:string authResponse, )
            createEletter(xs:string subject, xs:string templateName, xs:string xmlContent, )
            getChallenge()
            getError()
            reset()
            setConfirm(xs:string confirm, )
            setConsent(xs:string consent, )
            setData(xs:integer dataId, xs:string dataValue, )
            setEmailAddress(xs:string address, )
            setIpAddress(xs:string ipAddress, )
            setLanguage(xs:string language, )
            setListId(xs:integer listId, )
            subscribe()
            unsubscribe()
         Types (0):
  

Интересно, могу ли я использовать эти методы и параметры для автоматической генерации модульных или функциональных тестов.

вот WSDL:

 <?xml version='1.0' encoding='UTF-8'?>
<definitions name="service" targetNamespace="urn:service" xmlns:typens="urn:service" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
    <message name="createEletter">
        <part name="subject" type="xsd:string"/>
        <part name="templateName" type="xsd:string"/>
        <part name="xmlContent" type="xsd:string"/>
    </message>
    <message name="createEletterResponse">
        <part name="createEletterResponse" type="xsd:integer"/>
    </message>

    <message name="setLanguage">
        <part name="language" type="xsd:string"/>
    </message>
    <message name="setLanguageResponse">
        <part name="setLanguageReturn" type="xsd:integer"/>
    </message>

    <message name="setIpAddress">
        <part name="ipAddress" type="xsd:string"/>
    </message>
    <message name="setIpAddressResponse">
        <part name="setIpAddressReturn" type="xsd:integer"/>
    </message>

    <message name="setConfirm">
        <part name="confirm" type="xsd:string"/>
    </message>
    <message name="setConfirmResponse">
        <part name="setConfirmReturn" type="xsd:integer"/>
    </message>

    <message name="setConsent">
        <part name="consent" type="xsd:string"/>
    </message>
    <message name="setConsentResponse">
        <part name="setConsentReturn" type="xsd:integer"/>
    </message>

        <message name="getChallenge"/>
    <message name="getChallengeResponse">
        <part name="getChallengeReturn" type="xsd:string"/>
    </message>

    <message name="authenticate">
        <part name="authId" type="xsd:integer"/>
        <part name="authResponse" type="xsd:string"/>
    </message>

    <message name="authenticateResponse">
        <part name="authenticateReturn" type="xsd:integer"/>
    </message>

    <message name="getError"/>
    <message name="getErrorResponse">
        <part name="getErrorReturn" type="xsd:string"/>
    </message>

    <message name="reset"/>
    <message name="resetResponse">
        <part name="resetReturn" type="xsd:integer"/>
    </message>

    <message name="setData">
        <part name="dataId" type="xsd:integer"/>
        <part name="dataValue" type="xsd:string"/>
    </message>

    <message name="setDataResponse">
        <part name="setDataReturn" type="xsd:integer"/>
    </message>

    <message name="setEmailAddress">
        <part name="address" type="xsd:string"/>
    </message>

    <message name="setEmailAddressResponse">
        <part name="setEmailAddressReturn" type="xsd:integer"/>
    </message>

    <message name="setListId">
        <part name="listId" type="xsd:integer"/>
    </message>

    <message name="setListIdResponse">
        <part name="setListIdReturn" type="xsd:integer"/>
    </message>

    <message name="subscribe"/>
    <message name="subscribeResponse">
        <part name="subscribeReturn" type="xsd:integer"/>
    </message>

    <message name="unsubscribe"/>
    <message name="unsubscribeResponse">
        <part name="unsubscribeReturn" type="xsd:integer"/>
    </message>

    <portType name="EbrevSubscriptionServicePortType">
        <operation name="createEletter">
            <input message="typens:createEletter"/>
            <output message="typens:createEletterResponse"/>
        </operation>
            <operation name="setLanguage">
            <input message="typens:setLanguage"/>
            <output message="typens:setLanguageResponse"/>
        </operation>
        <operation name="setIpAddress">
            <input message="typens:setIpAddress"/>
            <output message="typens:setIpAddressResponse"/>
        </operation>
        <operation name="setConfirm">
            <input message="typens:setConfirm"/>
            <output message="typens:setConfirmResponse"/>
        </operation>
        <operation name="setConsent">
            <input message="typens:setConsent"/>
            <output message="typens:setConsentResponse"/>
        </operation>
        <operation name="getChallenge">
            <input message="typens:getChallenge"/>
            <output message="typens:getChallengeResponse"/>
        </operation>
        <operation name="authenticate">
            <input message="typens:authenticate"/>
            <output message="typens:authenticateResponse"/>
        </operation>
        <operation name="getError">
            <input message="typens:getError"/>
            <output message="typens:getErrorResponse"/>
        </operation>
        <operation name="reset">
            <input message="typens:reset"/>
            <output message="typens:resetResponse"/>
        </operation>
        <operation name="setData">
            <input message="typens:setData"/>
            <output message="typens:setDataResponse"/>
        </operation>
        <operation name="setEmailAddress">
            <input message="typens:setEmailAddress"/>
            <output message="typens:setEmailAddressResponse"/>
        </operation>
        <operation name="setListId">
            <input message="typens:setListId"/>
            <output message="typens:setListIdResponse"/>
        </operation>
        <operation name="subscribe">
            <input message="typens:subscribe"/>
            <output message="typens:subscribeResponse"/>
        </operation>
        <operation name="unsubscribe">
            <input message="typens:unsubscribe"/>
            <output message="typens:unsubscribeResponse"/>
        </operation>
    </portType>
    <binding name="EbrevSubscriptionServiceBinding" type="typens:EbrevSubscriptionServicePortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="createEletter">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
        <operation name="setLanguage">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
    <operation name="setIpAddress">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
    <operation name="setConfirm">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
        <operation name="setConsent">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
        <operation name="getChallenge">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
        <operation name="authenticate">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
        <operation name="getError">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
        <operation name="reset">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
        <operation name="setData">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
        <operation name="setEmailAddress">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
        <operation name="setListId">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
        <operation name="subscribe">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
        <operation name="unsubscribe">
            <soap:operation soapAction="urn:EbrevSubscriptionServiceAction"/>
            <input>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body namespace="urn:service" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
    </binding>
    <service name="serviceService">
        <port name="EbrevSubscriptionServicePort" binding="typens:EbrevSubscriptionServiceBinding">
            <soap:address location="http://soa.ebrev.info/server.php"/>
        </port>
    </service>
</definitions>