Ë
    ¹2Úi2  ã                   ó,   — d dl mZ  G d„ de«      Zd„ Zy)é    )ÚXAccelRedirectResponsec                   óL   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zy)ÚXAccelRedirectValidatorz…Utility class to validate XAccelRedirectResponse instances.

    See also :py:func:`assert_x_accel_redirect` shortcut function.

    c                 óŠ   — | j                  ||«       |j                  «       D ]  \  }}t        | d|z  «      } ||||«       Œ  y)a.  Assert that ``response`` is a valid X-Accel-Redirect response.

        Optional ``assertions`` dictionary can be used to check additional
        items:

        * ``basename``: the basename of the file in the response.

        * ``content_type``: the value of "Content-Type" header.

        * ``redirect_url``: the value of "X-Accel-Redirect" header.

        * ``charset``: the value of ``X-Accel-Charset`` header.

        * ``with_buffering``: the value of ``X-Accel-Buffering`` header.
          If ``False``, then makes sure that the header disables buffering.
          If ``None``, then makes sure that the header is not set.

        * ``expires``: the value of ``X-Accel-Expires`` header.
          If ``False``, then makes sure that the header disables expiration.
          If ``None``, then makes sure that the header is not set.

        * ``limit_rate``: the value of ``X-Accel-Limit-Rate`` header.
          If ``False``, then makes sure that the header disables limit rate.
          If ``None``, then makes sure that the header is not set.

        z	assert_%sN)Ú assert_x_accel_redirect_responseÚitemsÚgetattr)ÚselfÚ	test_caseÚresponseÚ
assertionsÚkeyÚvalueÚassert_funcs          úV/var/www/html/acx/venv/lib/python3.12/site-packages/django_downloadview/nginx/tests.pyÚ__call__z XAccelRedirectValidator.__call__   sM   € ð6 	×-Ñ-¨i¸ÔBØ$×*Ñ*Ó,ò 	4‰JˆC�Ü! $¨°cÑ(9Ó:ˆKÙ˜	 8¨UÕ3ñ	4ó    c                 óB   — |j                  t        |t        «      «       y ©N)Ú
assertTrueÚ
isinstancer   )r
   r   r   s      r   r   z8XAccelRedirectValidator.assert_x_accel_redirect_response+   s   € Ø×ÑœZ¨Ô2HÓIÕJr   c                 ó<   — |j                  |j                  |«       y r   )ÚassertEqualÚbasename©r
   r   r   r   s       r   Úassert_basenamez'XAccelRedirectValidator.assert_basename.   s   € Ø×Ñ˜h×/Ñ/°Õ7r   c                 ó.   — |j                  |d   |«       y )NzContent-Type©r   r   s       r   Úassert_content_typez+XAccelRedirectValidator.assert_content_type1   s   € Ø×Ñ˜h ~Ñ6¸Õ>r   c                 ó.   — |j                  |d   |«       y )NzX-Accel-Redirectr   r   s       r   Úassert_redirect_urlz+XAccelRedirectValidator.assert_redirect_url4   s   € Ø×Ñ˜hÐ'9Ñ:¸EÕBr   c                 ó.   — |j                  |d   |«       y )NzX-Accel-Charsetr   r   s       r   Úassert_charsetz&XAccelRedirectValidator.assert_charset7   s   € Ø×Ñ˜hÐ'8Ñ9¸5ÕAr   c                 ó‚   — d}|€|j                  ||v «       y |r|j                  |d«       y |j                  |d«       y )NzX-Accel-BufferingÚyesÚno©ÚassertFalser   ©r
   r   r   r   Úheaders        r   Úassert_with_bufferingz-XAccelRedirectValidator.assert_with_buffering:   sB   € Ø$ˆØˆ=Ø×!Ñ! &¨HÐ"4Õ5ÙØ×!Ñ! &¨%Õ0à×!Ñ! &¨$Õ/r   c                 ó‚   — d}|€|j                  ||v «       y |s|j                  |d«       y |j                  ||«       y )NzX-Accel-ExpiresÚoffr'   r)   s        r   Úassert_expiresz&XAccelRedirectValidator.assert_expiresC   sB   € Ø"ˆØˆ=Ø×!Ñ! &¨HÐ"4Õ5ÙØ×!Ñ! &¨%Õ0à×!Ñ! &¨%Õ0r   c                 ó‚   — d}|€|j                  ||v «       y |s|j                  |d«       y |j                  ||«       y )NzX-Accel-Limit-Rater-   r'   r)   s        r   Úassert_limit_ratez)XAccelRedirectValidator.assert_limit_rateL   sB   € Ø%ˆØˆ=Ø×!Ñ! &¨HÐ"4Õ5ÙØ×!Ñ! &¨%Õ0à×!Ñ! &¨%Õ0r   c                 óz   — d}|r$|j                  ||   j                  d«      «       y |j                  ||v «       y )NzContent-DispositionÚ
attachment)r   Ú
startswithr(   r)   s        r   Úassert_attachmentz)XAccelRedirectValidator.assert_attachmentU   s;   € Ø&ˆÙØ× Ñ  ¨&Ñ!1×!<Ñ!<¸\Ó!JÕKà×!Ñ! &¨HÐ"4Õ5r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r!   r#   r+   r.   r0   r4   © r   r   r   r      s=   „ ñò4ò@Kò8ò?òCòBò0ò1ò1ó6r   r   c                 ó*   — t        «       } || |fi |¤ŽS )aô  Make ``test_case`` assert that ``response`` is a XAccelRedirectResponse.

    Optional ``assertions`` dictionary can be used to check additional items:

    * ``basename``: the basename of the file in the response.

    * ``content_type``: the value of "Content-Type" header.

    * ``redirect_url``: the value of "X-Accel-Redirect" header.

    * ``charset``: the value of ``X-Accel-Charset`` header.

    * ``with_buffering``: the value of ``X-Accel-Buffering`` header.
      If ``False``, then makes sure that the header disables buffering.
      If ``None``, then makes sure that the header is not set.

    * ``expires``: the value of ``X-Accel-Expires`` header.
      If ``False``, then makes sure that the header disables expiration.
      If ``None``, then makes sure that the header is not set.

    * ``limit_rate``: the value of ``X-Accel-Limit-Rate`` header.
      If ``False``, then makes sure that the header disables limit rate.
      If ``None``, then makes sure that the header is not set.

    )r   )r   r   r   Ú	validators       r   Úassert_x_accel_redirectr<   ]   s   € ô4 (Ó)€IÙ�Y Ñ7¨JÑ7Ð7r   N)Ú"django_downloadview.nginx.responser   Úobjectr   r<   r9   r   r   ú<module>r?      s   ðÝ EôV6˜fô V6ór8r   