11import time
22import unittest
3-
43from utils import (
54 generate_csv ,
65 upload_file_to_s3 ,
2524 FILE_NAME_VAL_ERROR ,
2625 environment
2726)
28- # load dotenv for run from desktop
29- # from dotenv import load_dotenv
30- # load_dotenv()
3127
3228
3329class TestE2EBatch (unittest .TestCase ):
34-
3530 def setUp (self ):
3631 self .uploaded_files = [] # Tracks uploaded input keys
3732 self .ack_files = [] # Tracks ack keys
@@ -46,8 +41,7 @@ def tearDown(self):
4641 def test_create_success (self ):
4742 """Test CREATE scenario."""
4843 monitor ("test_create_success" )
49- input_file = generate_csv ("PHYLIS" , "0.3" , "CREATE" ,
50- "RSV" , "YGM41" )
44+ input_file = generate_csv ("PHYLIS" , "0.3" , action_flag = "CREATE" )
5145
5246 key = upload_file_to_s3 (input_file , SOURCE_BUCKET , INPUT_PREFIX )
5347 self .uploaded_files .append (key )
@@ -67,9 +61,7 @@ def test_duplicate_create(self):
6761
6862 monitor ("test_duplicate_create" )
6963
70- input_file = generate_csv ("PHYLIS" , "0.3" , "CREATE" ,
71- "RSV" , "YGM41" ,
72- same_id = True )
64+ input_file = generate_csv ("PHYLIS" , "0.3" , action_flag = "CREATE" , same_id = True )
7365
7466 key = upload_file_to_s3 (input_file , SOURCE_BUCKET , INPUT_PREFIX )
7567 self .uploaded_files .append (key )
@@ -87,7 +79,7 @@ def test_duplicate_create(self):
8779 def test_update_success (self ):
8880 """Test UPDATE scenario."""
8981 monitor ("test_update_success" )
90- input_file = generate_csv ("PHYLIS" , "0.5" , "UPDATE" , "RSV" , "YGM41 " )
82+ input_file = generate_csv ("PHYLIS" , "0.5" , action_flag = "UPDATE" )
9183
9284 key = upload_file_to_s3 (input_file , SOURCE_BUCKET , INPUT_PREFIX )
9385 self .uploaded_files .append (key )
@@ -104,7 +96,7 @@ def test_update_success(self):
10496 def test_reinstated_success (self ):
10597 """Test REINSTATED scenario."""
10698 monitor ("test_reinstated_success" )
107- input_file = generate_csv ("PHYLIS" , "0.5" , "REINSTATED" , "RSV" , "YGM41 " )
99+ input_file = generate_csv ("PHYLIS" , "0.5" , action_flag = "REINSTATED" )
108100
109101 key = upload_file_to_s3 (input_file , SOURCE_BUCKET , INPUT_PREFIX )
110102 self .uploaded_files .append (key )
@@ -121,7 +113,7 @@ def test_reinstated_success(self):
121113 def test_update_reinstated_success (self ):
122114 """Test UPDATE-REINSTATED scenario."""
123115 monitor ("test_update_reinstated_success" )
124- input_file = generate_csv ("PHYLIS" , "0.5" , "UPDATE-REINSTATED" , "RSV" , "YGM41 " )
116+ input_file = generate_csv ("PHYLIS" , "0.5" , action_flag = "UPDATE-REINSTATED" )
125117
126118 key = upload_file_to_s3 (input_file , SOURCE_BUCKET , INPUT_PREFIX )
127119 self .uploaded_files .append (key )
@@ -138,7 +130,7 @@ def test_update_reinstated_success(self):
138130 def test_delete_success (self ):
139131 """Test DELETE scenario."""
140132 monitor ("test_delete_success" )
141- input_file = generate_csv ("PHYLIS" , "0.8" , "DELETE" , "RSV" , "YGM41 " )
133+ input_file = generate_csv ("PHYLIS" , "0.8" , action_flag = "DELETE" )
142134
143135 key = upload_file_to_s3 (input_file , SOURCE_BUCKET , INPUT_PREFIX )
144136 self .uploaded_files .append (key )
@@ -155,7 +147,7 @@ def test_delete_success(self):
155147 def test_pre_validation_error (self ):
156148 """Test PRE-VALIDATION error scenario."""
157149 monitor ("test_pre_validation_error" )
158- input_file = generate_csv ("PHYLIS" , "TRUE" , "CREATE" , "RSV" , "YGM41 " )
150+ input_file = generate_csv ("PHYLIS" , "TRUE" , action_flag = "CREATE" )
159151
160152 key = upload_file_to_s3 (input_file , SOURCE_BUCKET , INPUT_PREFIX )
161153 self .uploaded_files .append (key )
@@ -172,7 +164,7 @@ def test_pre_validation_error(self):
172164 def test_post_validation_error (self ):
173165 """Test POST-VALIDATION error scenario."""
174166 monitor ("test_post_validation_error" )
175- input_file = generate_csv ("" , "0.3" , "CREATE" , "RSV" , "YGM41 " )
167+ input_file = generate_csv ("" , "0.3" , action_flag = "CREATE" )
176168
177169 key = upload_file_to_s3 (input_file , SOURCE_BUCKET , INPUT_PREFIX )
178170 self .uploaded_files .append (key )
@@ -187,7 +179,7 @@ def test_post_validation_error(self):
187179 def test_file_name_validation_error (self ):
188180 """Test FILE-NAME-VALIDATION error scenario."""
189181 monitor ("test_file_name_validation_error" )
190- input_file = generate_csv ("PHYLIS" , "0.3" , "CREATE" , "RSV" , "YGM41 " , file_key = True )
182+ input_file = generate_csv ("PHYLIS" , "0.3" , action_flag = "CREATE" , file_key = True )
191183
192184 key = upload_file_to_s3 (input_file , SOURCE_BUCKET , INPUT_PREFIX )
193185 self .uploaded_files .append (key )
@@ -202,7 +194,7 @@ def test_file_name_validation_error(self):
202194 def test_header_name_validation_error (self ):
203195 """Test HEADER-NAME-VALIDATION error scenario."""
204196 monitor ("test_header_name_validation_error" )
205- input_file = generate_csv ("PHYLIS" , "0.3" , "CREATE" , "RSV" , "YGM41 " , headers = "NH_NUMBER" )
197+ input_file = generate_csv ("PHYLIS" , "0.3" , action_flag = "CREATE" , headers = "NH_NUMBER" )
206198
207199 key = upload_file_to_s3 (input_file , SOURCE_BUCKET , INPUT_PREFIX )
208200 self .uploaded_files .append (key )
@@ -224,7 +216,7 @@ def test_invalid_permission(self):
224216 upload_config_file ("MMR_FULL" ) # permissions_config.json is updated here
225217 time .sleep (20 )
226218
227- input_file = generate_csv ("PHYLIS" , "0.3" , "CREATE" , "RSV" , "YGM41 " )
219+ input_file = generate_csv ("PHYLIS" , "0.3" , action_flag = "CREATE" )
228220
229221 key = upload_file_to_s3 (input_file , SOURCE_BUCKET , INPUT_PREFIX )
230222 self .uploaded_files .append (key )
0 commit comments