
    <e                     J   	 d dl Z d dlZd dlmZ d dlmZmZ d dlZ ej                    5   ej	        de
            ed          Zddd           n# 1 swxY w Y   d dlZd Z G d dej                  Z G d	 d
ej                  Zedk    r ej                     dS dS )    N)import_module)TESTFNunlinkignoremsilibc                  d    t           dz   } t          j        | t          j        dddd          }|| fS )Nz.msizPython Testsproduct_codez1.0PSF)r   r   init_databaseschema)pathdbs     '/usr/lib/python3.11/test/test_msilib.pyr   r      s<    F?D		
 
B t8O    c                   D    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
S )MsiDatabaseTestCasec                    t                      \  }}g }|                    d          }|                    d            	 |                                }|n)|                    |                    d                     @|                                 |                                 |                     |g d           |                     t          |           d S )Nz$SELECT Property, Value FROM PropertyT   )ProductNameProductCodeProductVersionManufacturerProductLanguage)
r   OpenViewExecuteFetchappend	GetStringCloseassertEqual
addCleanupr   )selfr   db_path
propertiesviewrecords         r   test_view_fetch_returns_nonez0MsiDatabaseTestCase.test_view_fetch_returns_none   s    #ooG
{{ABBT	3ZZ\\F~f..q11222		3
 	





  	
 	
 	
 	(((((r   c                 |   t                      \  }}|                    d          }|                    d            |                                }|                     |                    d          d           |                                 |                                 |                     t          |           d S )Nu&   SELECT 'ß-розпад' FROM Propertyr   u   ß-розпад)	r   r   r   r   r    r   r   r!   r   )r"   r   r#   r%   r&   s        r   test_view_non_asciiz'MsiDatabaseTestCase.test_view_non_ascii1   s    #ooG{{CDDT))!,,.?@@@





(((((r   c                 &   t                      \  }}	 |                    d          }|                    t          j                  }|                     |d           |                    t          j        d           |                    t          j                  }|                     |d           |                    t          j        d           |                    t          j                  }|                     |d           |                    t          j        d           |                    t          j                  }|                     |d           d }d }t          j        |           d S # d }d }t          j        |           w xY w)	Nc   s   Installation Database  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)	r   GetSummaryInformationGetPropertyr   	PID_TITLEr    SetPropertyosr   )r"   r   r#   sum_infotitles        r   &test_summaryinfo_getproperty_issue1104z:MsiDatabaseTestCase.test_summaryinfo_getproperty_issue1104;   sf   #ooG	//33H(()9::EU$<===  !19===(()9::EUJ///  !1:>>>(()9::EUK000  !1:>>>(()9::EUK000BHIg BHIgs   E	E6 6Fc                    |                      t          j                  5 }t          j        dt          j                   d d d            n# 1 swxY w Y   |                     t          |j                  d           d S )Nznon-existent.msizopen failed)assertRaisesr   MSIErrorOpenDatabaseMSIDBOPEN_READONLYr    str	exception)r"   cms     r   test_database_open_failedz-MsiDatabaseTestCase.test_database_open_failedR   s    v// 	O2 2F4MNNN	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	OR\**M:::::s    AAAc                 L   t           j                            t          d          }|                     t
          j                  5 }t          j        |t
          j                   d d d            n# 1 swxY w Y   | 	                    t          |j                  d           d S )Nztest.msizcreate failed)r3   r   joinr   r8   r   r9   r:   MSIDBOPEN_CREATEr    r<   r=   )r"   r#   r>   s      r   test_database_create_failedz/MsiDatabaseTestCase.test_database_create_failedW   s    ',,vz22v// 	B2)@AAA	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	BR\**O<<<<<s    A11A58A5c                    t                      \  }}|                    d          }|                     |                    t          j                             |                                 |                     t          |           d S )Nr   )	r   r/   assertIsNoner0   r   PID_SECURITYr   r!   r   )r"   r   r#   summarys       r   test_get_property_vt_emptyz.MsiDatabaseTestCase.test_get_property_vt_empty]   sn    #ooG**1--'--f.ABBCCC



(((((r   c           	         t                      \  }}|                     t          |           |                     |j                   |                     t          j        j                   t	          j        |dddd          }t	          j        d          }t	          j	        ||d t          ddd          }|                    d |d d           d S )	Nr   Featurez	A featurePythonCAB	TARGETDIR	SourceDirkeyfile)r   r!   r   r   r   _directoriesclearrJ   rL   	Directoryr   start_component)r"   r   r#   featurecabdirs         r   &test_directory_start_component_keyfilez:MsiDatabaseTestCase.test_directory_start_component_keyfiled   s    #ooG(((!!!+1222.Q	;IIjr3fk*A/ /D'4;;;;;r   c                 V   t                      \  }}|                     t          |           |                     |j                   |                    d          }|                     t          j                  5  |                    d           d d d            d S # 1 swxY w Y   d S )Nr   )	r   r!   r   r   r/   r8   r   r9   r0   )r"   r   r#   sis       r   "test_getproperty_uninitialized_varz6MsiDatabaseTestCase.test_getproperty_uninitialized_varo   s    #ooG(((!!!%%a((v// 	 	NN2	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   ;BB"%B"c                    t           dz   }t           dz   }|                     t          |           t          |d          5  	 d d d            n# 1 swxY w Y   |                     t          |           t	          j        ||dfg           |                     t          j        	                    |                     d S )Nz.txtz.cabwbztest.txt)
r   r!   r   openr   	FCICreate
assertTruer3   r   isfile)r"   filepathcabpaths      r   test_FCICreatez"MsiDatabaseTestCase.test_FCICreatew   s    F?6/)))(D!! 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	(((Hj#9":;;;w//00000s    AAAN)__name__
__module____qualname__r'   r)   r6   r?   rC   rH   rW   r[   rd    r   r   r   r      s        ) ) )*) ) )  .; ; ;
= = =) ) )	< 	< 	<  1 1 1 1 1r   r   c                   "    e Zd Z	 d Zd Zd ZdS )Test_make_idc                    |                      t          j        d          d           |                      t          j        d          d           |                      t          j        d          d           |                      t          j        d          d           |                      t          j        d          d           d S )Nshortnochangerequiredzone.dot_ar    r   make_idr"   s    r   test_is_no_change_requiredz'Test_make_id.test_is_no_change_required   s    N7##W	. 	. 	.N-..0B	D 	D 	DN9%%y	2 	2 	2N3	& 	& 	&N3	& 	& 	& 	& 	&r   c                     |                      t          j        d          d           |                      t          j        d          d           d S )Nz9.shortz_9.shortz.shortz_.shortrp   rr   s    r   test_invalid_first_charz$Test_make_id.test_invalid_first_char   sZ    N9%%z	3 	3 	3N8$$i	1 	1 	1 	1 	1r   c                     |                      t          j        d          d           |                      t          j        d          d           d S )Nu   .sortz_.s_ortu
   .so?*+rtz
_.s_o___rtrp   rr   s    r   test_invalid_any_charz"Test_make_id.test_invalid_any_char   sZ    N;''	4 	4 	4N>**L	: 	: 	: 	: 	:r   N)re   rf   rg   rs   ru   rw   rh   r   r   rj   rj      sF        
& 
& 
&1 1 1: : : : :r   rj   __main__)r3   unittesttest.support.import_helperr   test.support.os_helperr   r   warningscatch_warningssimplefilterDeprecationWarningr   msilib.schemar   TestCaser   rj   re   mainrh   r   r   <module>r      s   ) 				  4 4 4 4 4 4 1 1 1 1 1 1 1 1 X % %H($6777]8$$F% % % % % % % % % % % % % % %    
 
 
e1 e1 e1 e1 e1(+ e1 e1 e1P :  :  :  :  :8$  :  :  :F zHMOOOOO s   AAA