
                             d 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lmZ ddlmZ ddiZ G d dej&                        Zy)z3Tests for private service connect custom endpoints.    )absolute_import)print_function)division)unicode_literals)config)DEFAULT_HOST)testcase)integration_testcase)ObjectToURI)SetBotoConfigForTest)unittestPYTHONUNBUFFERED1c                      e Zd ZdZ ej
                  d       ej                  d      d               Z ej                  d       ej                  d      d               Z	 ej
                  d       ej                  d      d               Z
 ej                  d       ej                  d      d               Z ej                  d       ej                  d      d	               Zy
)TestPscz+Integration tests for PSC custom endpoints.z
JSON test.z&Custom endpoints not available for S3.c                    t        j                  ddt              }|t        k(  ry | j                         }t	        ddg      5  | j                         }| j                  |d      }| j                  ddt        |      |gt        d	
      }d d d        | j                  |       | j                  t        |       y # 1 sw Y   2xY w)NCredentialsgs_json_hostGSUtil sliced_object_download_threshold1Br   %sliced_object_download_component_sizer      foo
bucket_uricontents-DDcpTenv_varsreturn_stdout)r   getr   CreateTempDirr   CreateBucketCreateObject	RunGsUtilr   PYTHON_UNBUFFERED_ENV_VARassertInassertNotIn)selfgs_hosttemporary_directoryr   key_uristdouts         'platform/gsutil/gslib/tests/test_psc.py:test_persists_custom_endpoint_through_json_sliced_downloadzBTestPsc.test_persists_custom_endpoint_through_json_sliced_download&   s     jjEG,,,.	<A 
 $$&j!!Z&!Ig~~$G,.A
B,  f
 	MM'6"\6*
 
s   A	B==Cz	XML test.c                    t        j                  ddt              }|t        k(  ry | j                         }t	        ddg      5  | j                         }| j                  |d      }| j                  ddt        |      |gd	d	
      \  }}d d d        z   }| j                  ||       | j                  dt        z   |       y # 1 sw Y   :xY w)Nr   r-   r   r   r   r   -Dr    Tr#   return_stderr	hostname=)r   r$   r   r%   r   r&   r'   r(   r   r*   r+   )r,   r-   r.   r   r/   r0   stderroutputs           r1   9test_persists_custom_endpoint_through_xml_sliced_downloadzATestPsc.test_persists_custom_endpoint_through_xml_sliced_download>   s     jj	<@G,,,.	<A 
 $$&j!!Z&!Ig~~{7+-@
A & nff
 f_FMM'6"[</8
 
s   ACCc           	      p   t        j                  ddt              }|t        k(  ry | j                  d      }t	        ddg      5  | j                         }| j                  dd|t        |      gt        d	
      }d d d        | j                  |       | j                  t        |       y # 1 sw Y   2xY w)Nr   r   r   r   r   #parallel_composite_upload_thresholdr   r   (parallel_composite_upload_component_sizer   r   r    Tr!   )r   r$   r   CreateTempFiler   r&   r(   r   r)   r*   r+   )r,   r-   temporary_filer   r0   s        r1   Dtest_persists_custom_endpoint_through_json_parallel_composite_uploadzLTestPsc.test_persists_custom_endpoint_through_json_parallel_composite_uploadW   s     jjEG,((&(9N	?D 
 $$&j~~$z"$,	  f
 	MM'6"\6*
 
s   6B,,B5c           	      ~   t        j                  ddt              }|t        k(  ry | j                  d      }t	        ddg      5  | j                         }| j                  dd|t        |      gd	d	
      \  }}d d d        z   }| j                  ||       | j                  dt        z   |       y # 1 sw Y   :xY w)Nr   r-   r   r<   r=   r?   r4   r    Tr5   r7   
r   r$   r   rA   r   r&   r(   r   r*   r+   r,   r-   rB   r   r0   r8   r9   s          r1   Ctest_persists_custom_endpoint_through_xml_parallel_composite_uploadzKTestPsc.test_persists_custom_endpoint_through_xml_parallel_composite_uploado   s     jj	<@G,((&(9N	?D 
 $$&j~~~z"$	 & nff
 f_FMM'6"[</8
 
s   5B33B<c           	      |   t        j                  ddt              }|t        k(  ry | j                  d      }t	        dg      5  | j                         }| j                  dd|t        |      gdd	      \  }}d d d        z   }| j                  ||       | j                  d
t        z   |       y # 1 sw Y   :xY w)Nr   r-   r   r<   )r   resumable_thresholdr   r4   r    Tr5   r7   rE   rF   s          r1   6test_persists_custom_endpoint_through_resumable_uploadz>TestPsc.test_persists_custom_endpoint_through_resumable_upload   s     jj	<@G,((&(9N	EF	G$$&j~~~z"$	 & nff 
H f_FMM'6"[</8 
H	Gs   5B22B;N)__name__
__module____qualname____doc__r
   
SkipForXML	SkipForS3r2   SkipForJSONr:   rC   rG   rJ        r1   r   r   #   s%   3"""<0!!!"JK+ L 1+, $##K0!!!"JK9 L 19. #""<0!!!"JK+ L 1+, $##K0!!!"JK9 L 19, $##K0!!!"JK9 L 19rS   r   N)rN   
__future__r   r   r   r   botor   gslib.gcs_json_apir   gslib.testsr	   gslib.tests.testcaser
   gslib.tests.utilr   r   r   r)   GsUtilIntegrationTestCaser   rR   rS   r1   <module>r[      sL    : & %  '  +   5 ( 1 % 05 w9h00 w9rS   