@@ -206,7 +206,8 @@ def test_get_comment(client, comment):
206206
207207
208208@pytest .mark .parametrize (
209- 'lecturer_n,response_status' , [(0 , status .HTTP_200_OK ), (1 , status .HTTP_200_OK ), (3 , status .HTTP_200_OK )]
209+ 'lecturer_n,response_status' ,
210+ [(0 , status .HTTP_200_OK ), (1 , status .HTTP_200_OK ), (2 , status .HTTP_200_OK ), (3 , status .HTTP_404_NOT_FOUND )],
210211)
211212def test_comments_by_lecturer_id (client , lecturers_with_comments , lecturer_n , response_status ):
212213 lecturers , comments = lecturers_with_comments
@@ -217,8 +218,10 @@ def test_comments_by_lecturer_id(client, lecturers_with_comments, lecturer_n, re
217218 assert len (json_response ["comments" ]) == len (
218219 [
219220 comment
220- for comment in lecturers [lecturer_n ].comments
221- if comment .review_status == ReviewStatus .APPROVED and not comment .is_deleted
221+ for comment in comments
222+ if comment .lecturer_id == lecturers [lecturer_n ].id
223+ and comment .review_status == ReviewStatus .APPROVED
224+ and not comment .is_deleted
222225 ]
223226 )
224227
@@ -228,15 +231,15 @@ def test_comments_by_lecturer_id(client, lecturers_with_comments, lecturer_n, re
228231)
229232def test_comments_by_user_id (client , lecturers_with_comments , user_id , response_status ):
230233 _ , comments = lecturers_with_comments
231- response = response = client .get (f'{ url } ' , params = {"user_id" : user_id })
234+ response = client .get (f'{ url } ' , params = {"user_id" : 9990 + user_id })
232235 assert response .status_code == response_status
233236 if response .status_code == status .HTTP_200_OK :
234237 json_response = response .json ()
235238 assert len (json_response ["comments" ]) == len (
236239 [
237240 comment
238241 for comment in comments
239- if comment .user_id == user_id
242+ if comment .user_id == 9990 + user_id
240243 and comment .review_status == ReviewStatus .APPROVED
241244 and not comment .is_deleted
242245 ]
0 commit comments