@@ -116,7 +116,8 @@ def test_long_global_key_validation(client, dataset, image_url):
116116 'error' ] == 'Invalid assignment. Either DataRow does not exist, or globalKey is invalid'
117117
118118
119- def test_global_key_with_whitespaces_validation (client , dataset , image_url ):
119+ def test_global_key_with_whitespaces_validation (client , dataset , image_url ,
120+ is_adv_enabled ):
120121 dr_1 = dataset .create_data_row (row_data = image_url )
121122 dr_2 = dataset .create_data_row (row_data = image_url )
122123 dr_3 = dataset .create_data_row (row_data = image_url )
@@ -137,19 +138,27 @@ def test_global_key_with_whitespaces_validation(client, dataset, image_url):
137138 }]
138139 res = client .assign_global_keys_to_data_rows (assignment_inputs )
139140
140- assert len (res ['results' ]) == 0
141- assert len (res ['errors' ]) == 3
142- assert res ['status' ] == 'FAILURE'
143- assign_errors_ids = set ([e ['data_row_id' ] for e in res ['errors' ]])
144- assign_errors_gks = set ([e ['global_key' ] for e in res ['errors' ]])
145- assign_errors_msgs = set ([e ['error' ] for e in res ['errors' ]])
146- assert assign_errors_ids == set ([dr_1 .uid , dr_2 .uid , dr_3 .uid ])
147- assert assign_errors_gks == set ([gk_1 , gk_2 , gk_3 ])
148- assert assign_errors_msgs == set ([
149- 'Invalid assignment. Either DataRow does not exist, or globalKey is invalid' ,
150- 'Invalid assignment. Either DataRow does not exist, or globalKey is invalid' ,
151- 'Invalid assignment. Either DataRow does not exist, or globalKey is invalid'
152- ])
141+ if is_adv_enabled :
142+ assert res ['status' ] == 'PARTIAL SUCCESS'
143+ assert len (res ['results' ]) == 2
144+ assert len (res ['errors' ]) == 1
145+ assert res ['errors' ][0 ]['global_key' ] == gk_3
146+ assert res ['errors' ][0 ][
147+ 'error' ] == "Invalid assignment. Either DataRow does not exist, or globalKey is invalid"
148+ else :
149+ assert len (res ['results' ]) == 0
150+ assert len (res ['errors' ]) == 3
151+ assert res ['status' ] == 'FAILURE'
152+ assign_errors_ids = set ([e ['data_row_id' ] for e in res ['errors' ]])
153+ assign_errors_gks = set ([e ['global_key' ] for e in res ['errors' ]])
154+ assign_errors_msgs = set ([e ['error' ] for e in res ['errors' ]])
155+ assert assign_errors_ids == set ([dr_1 .uid , dr_2 .uid , dr_3 .uid ])
156+ assert assign_errors_gks == set ([gk_1 , gk_2 , gk_3 ])
157+ assert assign_errors_msgs == set ([
158+ 'Invalid assignment. Either DataRow does not exist, or globalKey is invalid' ,
159+ 'Invalid assignment. Either DataRow does not exist, or globalKey is invalid' ,
160+ 'Invalid assignment. Either DataRow does not exist, or globalKey is invalid'
161+ ])
153162
154163
155164def test_get_data_row_ids_for_global_keys (client , dataset , image_url ):
0 commit comments