1717
1818@pytest .mark .parametrize (
1919 "minio_config, crate_id, os_path_exists, os_path_isfile, os_path_isdir, " +
20- "return_value, webhook, profile, val_success, val_result, minio_client" ,
20+ "return_value, webhook, profile, profiles_path, val_success, val_result, minio_client" ,
2121 [
2222 (
2323 {
2828 "bucket" : "test_bucket"
2929 },
3030 "crate123" , True , True , False , "/tmp/crate.zip" ,
31- "https://example.com/hook" , "profileA" , True , '{"status": "valid"}' ,
31+ "https://example.com/hook" , "profileA" , None , True , '{"status": "valid"}' ,
3232 "minio_client"
3333 ),
3434 (
4040 "bucket" : "test_bucket"
4141 },
4242 "crate123" , True , False , True , "/tmp/crate123" ,
43- "https://example.com/hook" , "profileA" , True , '{"status": "valid"}' ,
43+ "https://example.com/hook" , "profileA" , None , True , '{"status": "valid"}' ,
4444 "minio_client"
4545 ),
4646 (
5252 "bucket" : "test_bucket"
5353 },
5454 "crate123" , True , False , True , "/tmp/crate123" ,
55- None , "profileA" , True , '{"status": "valid"}' ,
55+ None , "profileA" , None , True , '{"status": "valid"}' ,
5656 "minio_client"
5757 ),
5858 ],
@@ -80,7 +80,7 @@ def test_process_validation(
8080 mock_rmtree ,
8181 mock_client ,
8282 minio_config : dict , crate_id : str , os_path_exists : bool , os_path_isfile : bool , os_path_isdir : bool ,
83- return_value : str , webhook : str , profile : str , val_success : bool , val_result : str , minio_client : str
83+ return_value : str , webhook : str , profile : str , profiles_path : str , val_success : bool , val_result : str , minio_client : str
8484):
8585 mock_exists .return_value = os_path_exists
8686 mock_isfile .return_value = os_path_isfile
@@ -93,11 +93,11 @@ def test_process_validation(
9393 mock_validation_result .to_json .return_value = val_result
9494 mock_validate .return_value = mock_validation_result
9595
96- process_validation_task_by_id (minio_config , crate_id , "" , profile , webhook )
96+ process_validation_task_by_id (minio_config , crate_id , "" , profile , webhook , profiles_path )
9797
9898 mock_client .assert_called_once_with (minio_config )
9999 mock_fetch .assert_called_once_with (minio_client , minio_config ["bucket" ], crate_id , "" )
100- mock_validate .assert_called_once_with (return_value , profile )
100+ mock_validate .assert_called_once_with (return_value , profile , profiles_path = profiles_path )
101101 mock_update .assert_called_once_with (minio_client , minio_config ["bucket" ], crate_id , "" , val_result )
102102 if webhook is not None :
103103 mock_webhook .assert_called_once_with (webhook , val_result )
@@ -113,7 +113,7 @@ def test_process_validation(
113113
114114@pytest .mark .parametrize (
115115 "minio_config, crate_id, os_path_exists, os_path_isfile, os_path_isdir, return_fetch, "
116- + "webhook, profile, return_validate, validate_side_effect, fetch_side_effect, minio_client" ,
116+ + "webhook, profile, profiles_path, return_validate, validate_side_effect, fetch_side_effect, minio_client" ,
117117 [
118118 (
119119 {
@@ -124,7 +124,7 @@ def test_process_validation(
124124 "bucket" : "test_bucket"
125125 },
126126 "crate123" , True , True , False , "/tmp/crate.zip" ,
127- "https://example.com/hook" , "profileA" , "Validation failed" , None , None ,
127+ "https://example.com/hook" , "profileA" , None , "Validation failed" , None , None ,
128128 "minio_client"
129129 ),
130130 (
@@ -136,7 +136,7 @@ def test_process_validation(
136136 "bucket" : "test_bucket"
137137 },
138138 "crate123" , True , True , False , "/tmp/crate.zip" ,
139- "https://example.com/hook" , "profileA" , None , Exception ("Unexpected error" ), None ,
139+ "https://example.com/hook" , "profileA" , None , None , Exception ("Unexpected error" ), None ,
140140 "minio_client"
141141 ),
142142 (
@@ -148,7 +148,7 @@ def test_process_validation(
148148 "bucket" : "test_bucket"
149149 },
150150 "crate123" , False , False , False , None ,
151- "https://example.com/hook" , "profileA" , None , None , Exception ("MinIO fetch failed" ),
151+ "https://example.com/hook" , "profileA" , None , None , None , Exception ("MinIO fetch failed" ),
152152 "minio_client"
153153 ),
154154 ],
@@ -177,7 +177,7 @@ def test_process_validation_failure(
177177 mock_rmtree ,
178178 mock_client ,
179179 minio_config : dict , crate_id : str , os_path_exists : bool , os_path_isfile : bool , os_path_isdir : bool ,
180- return_fetch : str , webhook : str , profile : str , return_validate : str ,
180+ return_fetch : str , webhook : str , profile : str , profiles_path : str , return_validate : str ,
181181 validate_side_effect : Exception , fetch_side_effect : Exception , minio_client : str
182182):
183183 mock_exists .return_value = os_path_exists
@@ -195,10 +195,10 @@ def test_process_validation_failure(
195195 else :
196196 mock_validate .side_effect = validate_side_effect
197197
198- process_validation_task_by_id (minio_config , crate_id , "" , profile , webhook )
198+ process_validation_task_by_id (minio_config , crate_id , "" , profile , webhook , profiles_path )
199199
200200 if fetch_side_effect is None :
201- mock_validate .assert_called_once_with (return_fetch , profile )
201+ mock_validate .assert_called_once_with (return_fetch , profile , profiles_path = profiles_path )
202202 else :
203203 mock_validate .assert_not_called ()
204204
0 commit comments