AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/twisted/web/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/twisted/web/test/__pycache__/test_webclient.cpython-310.pyc
o

�b.�@s�dZddlmZddlmZddlmZGdd�dej�ZGdd�d�Z	Gd	d
�d
e	ej�Z
Gdd�de	ej�ZGd
d�de	ej�ZdS)z)
Tests L{twisted.web.client} helper APIs
�)�urlparse)�unittest)�clientc@s eZdZdZdd�Zdd�ZdS)�URLJoinTestsz'
    Tests for L{client._urljoin}.
    cCs@|�t�dd�d�|�t�dd�d�|�t�dd�d�dS)z�
        L{client._urljoin} does not include a fragment identifier in the
        resulting URL if neither the base nor the new path include a fragment
        identifier.
        �http://foo.com/bar�/quuxshttp://foo.com/quuxshttp://foo.com/bar#s/quux#N��assertEqualr�_urljoin��self�r
�A/usr/lib/python3/dist-packages/twisted/web/test/test_webclient.py�test_noFragmentss���zURLJoinTests.test_noFragmentscCs@|�t�dd�d�|�t�dd�d�|�t�dd�d�dS)a
        L{client._urljoin} preserves the fragment identifier from either the
        new path or the base URL respectively, as specified in the HTTP 1.1 bis
        draft.

        @see: U{https://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22#section-7.1.2}
        shttp://foo.com/bar#fragrshttp://foo.com/quux#fragrs/quux#frag2shttp://foo.com/quux#frag2Nrrr
r
r�test_preserveFragments$s
�
�
�z#URLJoinTests.test_preserveFragmentsN)�__name__�
__module__�__qualname__�__doc__rrr
r
r
rrsrc@s�eZdZdZdd�Z	d$dd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#S)%�URITestsa
    Abstract tests for L{twisted.web.client.URI}.

    Subclass this and L{unittest.TestCase}. Then provide a value for
    C{host} and C{uriHost}.

    @ivar host: A host specification for use in tests, must be L{bytes}.

    @ivar uriHost: The host specification in URI form, must be a L{bytes}. In
        most cases this is identical with C{host}. IPv6 address literals are an
        exception, according to RFC 3986 section 3.2.2, as they need to be
        enclosed in brackets. In this case this variable is different.
    cCsB|�|jt�|�|jt�|�|t�|�d|�|�d|j�S)a�
        Replace the string "HOST" in C{template} with this test's host.

        Byte strings Python between (and including) versions 3.0 and 3.4
        cannot be formatted using C{%} or C{format} so this does a simple
        replace.

        @type template: L{bytes}
        @param template: A string containing "HOST".

        @rtype: L{bytes}
        @return: A string where "HOST" has been replaced by C{self.host}.
        sHOST)�assertIsInstance�host�bytes�uriHost�assertIn�replace)r�templater
r
r�
makeURIStringIs
zURITests.makeURIString�c

Cs@|�||||||||	f|j|j|j|j|j|j|j|jf�dS)aU
        Assert that all of a L{client.URI}'s components match the expected
        values.

        @param uri: U{client.URI} instance whose attributes will be checked
            for equality.

        @type scheme: L{bytes}
        @param scheme: URI scheme specifier.

        @type netloc: L{bytes}
        @param netloc: Network location component.

        @type host: L{bytes}
        @param host: Host name.

        @type port: L{int}
        @param port: Port number.

        @type path: L{bytes}
        @param path: Hierarchical path.

        @type params: L{bytes}
        @param params: Parameters for last path segment, defaults to C{b''}.

        @type query: L{bytes}
        @param query: Query string, defaults to C{b''}.

        @type fragment: L{bytes}
        @param fragment: Fragment identifier, defaults to C{b''}.
        N)	r	�scheme�netlocr�port�path�params�query�fragment)
r�urirr rr!r"r#r$r%r
r
r�assertURIEquals]s"��zURITests.assertURIEqualscCsdtj�|�d��}|�d|j�tj�|�d��}|�d|j�tj�|�d��}|�d|j�dS)z�
        L{client.URI.fromBytes} by default assumes port 80 for the I{http}
        scheme and 443 for the I{https} scheme.
        �http://HOST�Pshttp://HOST:�https://HOSTi�N�r�URI�	fromBytesrr	r!�rr&r
r
r�test_parseDefaultPort�szURITests.test_parseDefaultPortcCsLtjj|�d�dd�}|�d|j�tjj|�d�dd�}|�d|j�dS)z�
        L{client.URI.fromBytes} accepts a C{defaultPort} parameter that
        overrides the normal default port logic.
        r(�)�defaultPortr*Nr+r.r
r
r�test_parseCustomDefaultPort�s
�z$URITests.test_parseCustomDefaultPortcCsjtj�|�d��}|�d|j�|�|j|j�|�|jd|j�tj�|�d��}|�|j|j�dS)zj
        Parsing a I{URI} splits the network location component into I{host} and
        I{port}.
        shttp://HOST:5144r0s:5144shttp://HOST N)	rr,r-rr	r!rrr r.r
r
r�test_netlocHostPort�szURITests.test_netlocHostPortcC�D|�d�}tj�|�}|j|d|j|jddd�|�||���dS)z/
        Parse the path from a I{URI}.
        shttp://HOST/foo/bar�httpr)�/foo/bar�rr rr!r"N�	rrr,r-r'rrr	�toBytes�rr&�parsedr
r
r�	test_path��
�zURITests.test_pathcCr4)zL
        The path of a I{URI} that has no path is the empty string.
        r(r5r)rr7Nr8r:r
r
r�test_noPath�r=zURITests.test_noPathcCs0|�d�}|jtj�|�d|j|jddd�dS)zE
        The path of a I{URI} with an empty path is C{b'/'}.
        �http://HOST/r5r)�/r7N)rr'rr,r-rrr.r
r
r�test_emptyPath�s


�zURITests.test_emptyPathc	CsF|�d�}tj�|�}|j|d|j|jdddd�|�||���dS)z8
        Parse I{URI} parameters from a I{URI}.
        shttp://HOST/foo/bar;paramr5r)r6�param)rr rr!r"r#Nr8r:r
r
r�
test_param�s
�	zURITests.test_paramc
CsH|�d�}tj�|�}|j|d|j|jddddd�|�||���dS)	z7
        Parse the query string from a I{URI}.
        s!http://HOST/foo/bar;param?a=1&b=2r5r)r6rB�a=1&b=2)rr rr!r"r#r$Nr8r:r
r
r�
test_query�s
�
zURITests.test_querycCsJ|�d�}tj�|�}|j|d|j|jdddddd�	|�||���d	S)
z>
        Parse the fragment identifier from a I{URI}.
        s&http://HOST/foo/bar;param?a=1&b=2#fragr5r)r6rBrDsfrag)rr rr!r"r#r$r%Nr8r:r
r
r�
test_fragments
�zURITests.test_fragmentcC�$tj�|�d��}|�d|j�dS)zn
        L{client.URI.originForm} produces an absolute I{URI} path including
        the I{URI} path.
        shttp://HOST/foos/fooN�rr,r-rr	�
originFormr.r
r
r�test_originForm�zURITests.test_originFormcCrG)z�
        L{client.URI.originForm} produces an absolute I{URI} path including
        the I{URI} path, parameters and query string but excludes the fragment
        identifier.
        shttp://HOST/foo;param?a=1#frags/foo;param?a=1NrHr.r
r
r�test_originFormComplex s�zURITests.test_originFormComplexcCrG)zp
        L{client.URI.originForm} produces a path of C{b'/'} when the I{URI}
        specifies no path.
        r(r@NrHr.r
r
r�test_originFormNoPath+rKzURITests.test_originFormNoPathcCrG)zv
        L{client.URI.originForm} produces a path of C{b'/'} when the I{URI}
        specifies an empty path.
        r?r@NrHr.r
r
r�test_originFormEmptyPath3rKz!URITests.test_originFormEmptyPathcCsV|�d�}|�d�}t|�tj�|�}|�|jt�|�|j	t�|�|j
t�dS)z�
        L{client.URI.fromBytes} parses the scheme, host, and path elements
        into L{bytes}, even when passed an URL which has previously been passed
        to L{urlparse} as a L{unicode} string.
        shttp://HOST/path�asciiN)r�decoderrr,r-rrrrr")r�	goodInput�badInputr&r
r
r� test_externalUnicodeInterference;s

z)URITests.test_externalUnicodeInterferenceN)rrr)rrrrrr'r/r2r3r<r>rArCrErFrJrLrMrNrSr
r
r
rr:s&
�0
rc@�eZdZdZdZZdS)�URITestsForHostnamez>
    Tests for L{twisted.web.client.URI} with host names.
    sexample.comN�rrrrrrr
r
r
rrUJ�rUc@rT)�URITestsForIPv4zG
    Tests for L{twisted.web.client.URI} with IPv4 host addresses.
    s192.168.1.67NrVr
r
r
rrXRrWrXc@s eZdZdZdZdZdd�ZdS)�URITestsForIPv6z�
    Tests for L{twisted.web.client.URI} with IPv6 host addresses.

    IPv6 addresses must always be surrounded by square braces in URIs. No
    attempt is made to test without.
    sfe80::20c:29ff:fea4:c60s[fe80::20c:29ff:fea4:c60]cCs<tj�d�}|�|jd�|�|jd�|�|��d�dS)z�
        Brackets around IPv6 addresses are stripped in the host field. The host
        field is then exported with brackets in the output of
        L{client.URI.toBytes}.
        shttp://[::1]:80/index.htmls::1s[::1]:80N)rr,r-r	rr r9r.r
r
r�"test_hostBracketIPv6AddressLiteralesz2URITestsForIPv6.test_hostBracketIPv6AddressLiteralN)rrrrrrrZr
r
r
rrYZs
rYN)
r�urllib.parser�
twisted.trialr�twisted.webr�TestCaserrrUrXrYr
r
r
r�<module>s+

Anon7 - 2022
AnonSec Team