11import  json 
22from  typing  import  TYPE_CHECKING 
3- from  uuid  import  UUID 
3+ from  uuid  import  uuid4 
44
55import  pytest 
66import  responses 
77from  click .testing  import  CliRunner 
88
99from  cycode .cli .main  import  main_cli 
1010from  tests .conftest  import  CLI_ENV_VARS , TEST_FILES_PATH , ZIP_CONTENT_PATH 
11- from  tests .cyclient .mocked_responses .scan_client  import  mock_scan_async_responses 
11+ from  tests .cyclient .mocked_responses .scan_client  import  mock_scan_responses 
12+ from  tests .cyclient .test_scan_client  import  get_zipped_file_scan_response , get_zipped_file_scan_url 
1213
1314_PATH_TO_SCAN  =  TEST_FILES_PATH .joinpath ('zip_content' ).absolute ()
1415
@@ -28,10 +29,11 @@ def _is_json(plain: str) -> bool:
2829@pytest .mark .parametrize ('output' , ['text' , 'json' ]) 
2930def  test_passing_output_option (output : str , scan_client : 'ScanClient' , api_token_response : responses .Response ) ->  None :
3031    scan_type  =  'secret' 
31-     scan_id  =  UUID ( '12345678-418f-47ee-abb0-012345678901' )
32+     scan_id  =  uuid4 ( )
3233
34+     mock_scan_responses (responses , scan_type , scan_client , scan_id , ZIP_CONTENT_PATH )
35+     responses .add (get_zipped_file_scan_response (get_zipped_file_scan_url (scan_type , scan_client ), ZIP_CONTENT_PATH ))
3336    responses .add (api_token_response )
34-     mock_scan_async_responses (responses , scan_type , scan_client , scan_id , ZIP_CONTENT_PATH )
3537
3638    args  =  ['--output' , output , 'scan' , '--soft-fail' , 'path' , str (_PATH_TO_SCAN )]
3739    result  =  CliRunner ().invoke (main_cli , args , env = CLI_ENV_VARS )
0 commit comments