@@ -139,7 +139,7 @@ def test_login(user_authentication):
139139 assert user_authentication .status_code == 200
140140
141141
142- @pytest .mark .parametrize ('mandatory_field' , ['api-id' , 'comment' , 'parent_table' , 'parent_id' , 'user-id' , 'token' ])
142+ @pytest .mark .parametrize ('mandatory_field' , ['api-id' , 'comment' , 'parent_table' , 'parent_id' ])
143143def test_comment_post_bad_payload (client , user_authentication , api_sr_db , mandatory_field ):
144144 """ Post request with bad payload, missing fields """
145145
@@ -159,10 +159,7 @@ def test_comment_post_bad_payload(client, user_authentication, api_sr_db, mandat
159159 mapping_data .pop (mandatory_field )
160160
161161 response = client .post (_MAPPING_COMMENT_URL , json = mapping_data )
162- if mandatory_field in ['user-id' , 'token' ]:
163- assert response .status_code == HTTPStatus .UNAUTHORIZED
164- else :
165- assert response .status_code == HTTPStatus .BAD_REQUEST
162+ assert response .status_code == HTTPStatus .BAD_REQUEST
166163
167164
168165def test_comment_post_put_delete (client , user_authentication , api_sr_db ):
@@ -215,7 +212,7 @@ def test_comment_post_put_delete(client, user_authentication, api_sr_db):
215212
216213
217214@pytest .mark .parametrize ('mandatory_field' ,
218- ['api-id' , 'comment_id' , 'comment' , 'parent_table' , 'parent_id' , 'user-id' , 'token' ])
215+ ['api-id' , 'comment_id' , 'comment' , 'parent_table' , 'parent_id' ])
219216def test_comment_put_bad_payload (client , user_authentication , api_sr_db , mandatory_field ):
220217 """ Put request with bad payload, missing fields """
221218
@@ -236,13 +233,10 @@ def test_comment_put_bad_payload(client, user_authentication, api_sr_db, mandato
236233 mapping_data .pop (mandatory_field )
237234
238235 response = client .put (_MAPPING_COMMENT_URL , json = mapping_data )
239- if mandatory_field in ['user-id' , 'token' ]:
240- assert response .status_code == HTTPStatus .UNAUTHORIZED
241- else :
242- assert response .status_code == HTTPStatus .BAD_REQUEST
236+ assert response .status_code == HTTPStatus .BAD_REQUEST
243237
244238
245- @pytest .mark .parametrize ('mandatory_field' , ['api-id' , 'comment_id' , 'parent_table' , 'parent_id' , 'user-id' , 'token' ])
239+ @pytest .mark .parametrize ('mandatory_field' , ['api-id' , 'comment_id' , 'parent_table' , 'parent_id' ])
246240def test_comment_delete_bad_payload (client , user_authentication , api_sr_db , mandatory_field ):
247241 """ Delete request with bad payload, missing fields """
248242
@@ -261,8 +255,5 @@ def test_comment_delete_bad_payload(client, user_authentication, api_sr_db, mand
261255 # Generate bad payload removing a mandatory field
262256 mapping_data .pop (mandatory_field )
263257
264- response = client .put (_MAPPING_COMMENT_URL , json = mapping_data )
265- if mandatory_field in ['user-id' , 'token' ]:
266- assert response .status_code == HTTPStatus .UNAUTHORIZED
267- else :
268- assert response .status_code == HTTPStatus .BAD_REQUEST
258+ response = client .delete (_MAPPING_COMMENT_URL , json = mapping_data )
259+ assert response .status_code == HTTPStatus .BAD_REQUEST
0 commit comments