
    b                        d Z ddlZddlZddlmZ dZdZdZej        d         Z	ej        d         Z
ej        d	         Zd
ede
Zej                            ed          Zej                            ed          Z G d de          ZdS )z!Blackbox tests for traffic_replay    N)BlackboxTestCasez$python/samba/tests/blackbox/testdatazscript/traffic_replayz!--fixed-password=trafficreplay01%SERVERPASSWORDUSERNAMEz-Uz%ztraffic-sample-very-short.modelztraffic_replay-%s.expectedc                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )TrafficLearnerTestsc                 l    d}t           d|dt          dt          }|                     |           d S )Nz
--clean-up )SCRIPTCREDSr   	check_runselfoptionscommands      E/usr/lib/python3/dist-packages/samba/tests/blackbox/traffic_replay.pytearDownzTrafficLearnerTests.tearDown&   s;    #)66777EEE66Bw    c                     d}t           d|dt          dt          dt          	}|                     |           t           dt
          d|dt          dt          dt          }|                     |           dS )zEEnsure the generate users only option functions correctly
           [--generate-users-only --number-of-users 20 --number-of-groups 5 --average-groups-per-user 2r
   N)r   FIXEDr   r   r   MODELr   s      r   test_generate_users_onlyz,TrafficLearnerTests.test_generate_users_only+   s    F FFGGGUUUEEE663wFFEEE777EEE555&&:wr   c                    t          dgdgddgg df          D ]\  }}|                                 5 }t          t          d|ddg|z   t          t
          t          gz   }|                     |           t          t          |z            
                                }t          |          
                                }|                     ||           ddd           n# 1 swxY w Y   dS )	z?Ensure a summary file is generated and the contents are correct--random-seed=3z--random-seed=4z--conversation-persistence=0.5)r   z--old-scalez--conversation-persistence=0.95z--traffic-summaryz-D1-S0.1N)	enumeratemktempr   r   r   r   r   r   openEXPECTED_OUTPUTreadassertStringsEqual)r   ioptsoutputr   expectedactuals          r   test_summary_generationz+TrafficLearnerTests.test_summary_generation7   sM    !#4"5#4"5#4#C#E#F #F #F	"$ % % 	: 	:GAt  	:&"E/!7,    "5&1	2
 w'''! 34499;;f**,,''&999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:	: 	:s   B CC#	&C#	c                 f    t           t          t          t          g}|                     |d           dS )z>Ensure a summary file with no fixed password fails
              N)r   r   r   r   check_exit_coder   r   s     r   test_summary_replay_no_fixedz0TrafficLearnerTests.test_summary_replay_no_fixedM   s.     5%0Wa(((((r   c                 t    t           t          t          ddt          t          g}|                     |           dS )z7Ensure a model can be replayed against a DC
           z-D2r   N)r   r   r   r   r   r   r,   s     r   test_model_replayz%TrafficLearnerTests.test_model_replayS   s7     5'&" 	wr   c           	          d}t           d|dt          dt          }|                     |d           t           dt          d|dt          dt          	}|                     |d           dS )zOEnsure the generate users only fails if no fixed_password supplied"
           r   r
   r*   N)r   r   r   r+   r   r   s      r   $test_generate_users_only_no_passwordz8TrafficLearnerTests.test_generate_users_only_no_password\   sz    F$*FFGGGUUUFFCWa(((&,ffeeeWWWeeeVVLWa(((((r   N)	__name__
__module____qualname__r   r   r(   r-   r/   r1    r   r   r   r   $   sn             

  
  
 : : :,) ) )     ) ) ) ) )r   r   )__doc__ostempfilesamba.testsr   DATA_DIRr   r   environr   r   USERr   pathjoinr   r    r   r5   r   r   <module>r?      s   $ ( ' 				  ( ( ( ( ( (6'3
8$
:&
:&"ddHH-X'HII',,x)EFF@) @) @) @) @)* @) @) @) @) @)r   