o
    i                     @   s   d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d d	lmZ d d
lmZ dd ZG dd de jZedkrQe   dS dS )    N)six)StringIO)Soap11)WsgiApplication)Application)Unicode)rpc)WSDL11)Servicec                 C   s   t | | d S Nprint)codeheaders r   ^/var/www/html/LicenciasMIG/venv/lib/python3.10/site-packages/spyne/test/interface/test_wsgi.pystart_response"   s   r   c                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
Testc                 C   s4   G dd dt }t|gdt t d}t|| _d S )Nc                   @   s   e Zd Zeedd ZdS )zTest.setUp.<locals>.SomeServicec                 S   s   t | d S r   r   )ctxsome_strr   r   r   	some_call)   s   z)Test.setUp.<locals>.SomeService.some_callN)__name__
__module____qualname__r   r   r   r   r   r   r   SomeService(   s    r   some_tns)in_protocolout_protocol)r
   r   r   r   wsgi_app)selfr   appr   r   r   setUp'   s
   z
Test.setUpc                    sH   d _  fdd} jjjjd|  jjjd  j dks"J d S )Nr   c                    s     j d7  _ d S )N   )hdocr   r   r   on_wsdl_document_built5   s   z8Test.test_document_built.<locals>.on_wsdl_document_builtwsdl_document_builthttp://some_url/r"   )r#   r   r%   wsdl11event_manageradd_listenerbuild_interface_document)r   r'   r   r&   r   test_document_built2   s   zTest.test_document_builtc                 C   s^   dd }| j jjjd| | j jjd | j jj }ddlm} |	|j
dks-J d S )Nc                 S   s   d| j _d S )Nehe)root_elttagr$   r   r   r   r'   ?   s   z?Test.test_document_manipulation.<locals>.on_wsdl_document_builtr(   r)   r   etreer/   )r   r%   r*   r+   r,   r-   get_interface_documentlxmlr3   
fromstringr1   )r   r'   dr3   r   r   r   test_document_manipulation>   s   zTest.test_document_manipulationc                 C   sL   d | ddddddt dt}d	d
lm} ||jtdks$J d S )N    /wsdl	localhost7000GEThttp)	PATH_INFOQUERY_STRINGSERVER_NAMESERVER_PORTREQUEST_METHODzwsgi.url_schemez
wsgi.inputr   r2   definitions)	joinr   r   r   r5   r3   r6   r1   r	   )r   retvalr3   r   r   r   	test_wsgiK   s   
zTest.test_wsgiN)r   r   r   r!   r.   r8   rH   r   r   r   r   r   &   s
    r   __main__)unittest
spyne.utilr   spyne.util.sixr   spyne.protocol.soap.soap11r   spyne.server.wsgir   spyne.applicationr   spyne.model.primitiver   spyne.decoratorr   spyne.const.xmlr	   spyne.servicer
   r   TestCaser   r   mainr   r   r   r   <module>   s   4