
    cY                     b    d dl mZ d dlZd dlZd dlmZ d dlmZ  G d dej                        Z	y)    )print_functionNfiles)basec                   H     e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
 xZS )	FilesConfigTestc                 \   t         t        |           t        j                  dddg      }| j                  |       t        j                  j                  |j                  d      }t        j                  j                  |j                  ddd      }t        j                  j                  |j                  d      }t        j                  j                  |j                  d	d
      }t        j                  j                  |d      }t        j                  j                  |j                  dd      }t        j                  |       t        j                  |       t        j                  |       t        j                  |       t        j                  |       t        t        j                  j                  |d      d      5 }|j                  d       d d d        t        t        j                  j                  |d      d      5 }|j                  d       d d d        t        t        j                  j                  |d      d      5 }	|	j                  d       d d d        t        t        j                  j                  |d      d      5 }|j                  d       d d d        t        t        j                  j                  |d      d      5 }
|
j                  d       d d d        t        t        j                  j                  |d      d      5 }|j                  d       d d d        | j                  t        j                  |j                               y # 1 sw Y   xY w# 1 sw Y   VxY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   wxY w)Nfake_package)zfake_module.py    )zother_fake_module.pyr   etcansiblezkolla-ansibletestzdir with spacezmulti spacezmore spacessub
subpackagefoowzFoo DatabarzBar DatabazzBaz Dataz__init__.pyz# emptyzfile with spc)superr   setUpfixturesPythonPackage
useFixtureospathjoinr   makedirsopenwriteDiveDir)selfpkg_fixturepkg_etcpkg_ansibledir_spcsdir_subdir_spcpkg_subr   foo_filebaz_filespc_filefile_	__class__s               6/usr/lib/python3/dist-packages/pbr/tests/test_files.pyr   zFilesConfigTest.setUp   s   ot*,,,'-
 	$'',,{//7ggll;#3#3Y#2F<77<< 0 02BCk&6&6&35'',,w.WW\\nl<

G
J
K 
H
N#"'',,w.4 	'NN:&	'"'',,w.4 	'NN:&	'"'',,{E2C8 	'HNN:&	'"'',,z=93? 	&8NN9%	&"'',,x93? 	&8NN9%	&"'',,~?E 	#KK	"	# 	[%5%567	' 	'	' 	'	' 	'	& 	&	& 	&	# 	#sH   M#
M0M=N
NN"#M-0M:=N
NN"N+c                     t        t                     }t        j                  |d      j                          | j	                  d|d   d          y )Nr   r
   r   r   packagesdictr   FilesConfigrunassertInr!   configs     r-   test_implicit_auto_packagez*FilesConfigTest.test_implicit_auto_packageB   sF     
 	&.1557lF7OJ$?@r   c                     t        t        d            }t        j                  |d      j                          | j	                  d|d   d          y )Nr
   )r/   r   r   r   r/   r0   r5   s     r-   test_auto_packagez!FilesConfigTest.test_auto_packageJ   sI    '

 	&.1557lF7OJ$?@r   c                     t        t        d            }t        j                  |d      j                          | j	                  d|d   d          y )Nz
  etc/pbr = etc/*
data_filesr   r
   z9
'etc/pbr/' = 
 'etc/foo'
'etc/pbr/sub' = 
 'etc/sub/bar'r   r<   r0   r5   s     r-   test_data_files_globbingz(FilesConfigTest.test_data_files_globbingS   sM    0

 	&.1557K7OL)	+r   c                     t        t        d            }t        j                  |d      j                          | j	                  d|d   d          y )Nz'
  'i like spaces' = 'dir with space'/*r;   r   r
   z4
'i like spaces/' = 
 'dir with space/file with spc'r   r<   r0   r5   s     r-   test_data_files_with_spacesz+FilesConfigTest.test_data_files_with_spaces^   sM    E

 	&.1557D7OL)	+r   c                     d}d}t        t        |            }t        j                  |d      j                          | j	                  ||d   d          y )Nz5
 'one space/two space' = 'multi space/more spaces'/*C
'one space/two space/' = 
 'multi space/more spaces/file with spc'r;   r   r
   r   r<   r0   r!   r<   expectedr6   s       r-   *test_data_files_with_spaces_subdirectoriesz:FilesConfigTest.test_data_files_with_spaces_subdirectoriesi   sZ    M
9 	 %

 	&.1557hw =>r   c                     d}d}t        t        |            }t        j                  |d      j                          | j	                  ||d   d          y )Nz8
'one space'/'two space' = 'multi space'/'more spaces'/*rA   r;   r   r
   r   r<   r0   rB   s       r-   -test_data_files_with_spaces_quoted_componentsz=FilesConfigTest.test_data_files_with_spaces_quoted_componentsw   s\     H 	A%

 	&.1557hw =>r   c                     t        t        d            }t        j                  |d      j                          | j	                  d|d   d          y )Nz
  share/ansible = ansible/*r;   r   r
   z}
'share/ansible/' = 
'share/ansible/kolla-ansible' = 
'share/ansible/kolla-ansible/test' = 
 'ansible/kolla-ansible/test/baz'r   r<   r0   r5   s     r-   8test_data_files_globbing_source_prefix_in_directory_namezHFilesConfigTest.test_data_files_globbing_source_prefix_in_directory_name   sS     :

 	&.15572 7OL)	+r   )__name__
__module____qualname__r   r7   r9   r=   r?   rD   rF   rH   __classcell__)r,   s   @r-   r   r      s.    $8LAA	+	+??+r   r   )

__future__r   r   r   	pbr.hooksr   	pbr.testsr   BaseTestCaser    r   r-   <module>rR      s*     & 	   z+d'' z+r   