@@ -33,14 +33,20 @@ public void TearDown()
3333 _factory . Dispose ( ) ;
3434 }
3535
36- private const string TeacherEmail = "will.devries7 @example.com" ; // has post id 21 and comment id 23
36+ private const string TeacherEmail = "anna.gruber160 @example.com" ; // has post id 34,35 and comment id 37
3737 private const string TeacherPassword = "Neidintulling!l33t" ;
38+ private const int TeacherPostID = 34 ;
39+ private const int TeacherCommentID = 37 ;
3840
39- private const string StudentEmail1 = "noa.gronningen47@example.com" ; // has post id 32 and comment id 37
40- private const string StudentPassword1 = "lettPassord123!" ;
41+ private const string StudentEmail1 = "jan.larsen9@example.com" ; //id 232, has post id 57, 58 and comment id 2
42+ private const string StudentPassword1 = "SuperHash!4" ;
43+ private const int StudentPostID1 = 57 ;
44+ private const int StudentCommentID1 = 2 ;
4145
42- private const string StudentEmail2 = "anna.gruber160 @example.com" ; // has post id 32 and commeent id 29
46+ private const string StudentEmail2 = "timian.saar85 @example.com" ; //id 85, has post id 36 and comment id 3
4347 private const string StudentPassword2 = "Neidintulling!l33t" ;
48+ private const int StudentPostID2 = 36 ;
49+ private const int StudentCommentID2 = 3 ;
4450
4551 private async Task < string > LoginAndGetToken ( string email , string password , bool success = true )
4652 {
@@ -294,16 +300,16 @@ public async Task DeletePostById_SuccessAndNotFound(string userEmail, string pas
294300
295301
296302
297- [ TestCase ( TeacherEmail , TeacherPassword , 21 , "Teacher updated own post" , HttpStatusCode . OK ) ] // Teacher edit their own post
298- [ TestCase ( TeacherEmail , TeacherPassword , 34 , "Teacher updated student’s post" , HttpStatusCode . OK ) ] // Teacher edits someone else’s post
299- [ TestCase ( StudentEmail1 , StudentPassword1 , 34 , "Student1 updated own post" , HttpStatusCode . OK ) ] // Student1 edits their own post
300- [ TestCase ( StudentEmail1 , StudentPassword1 , 40 , "Student1 tried updating Student2’s post" , HttpStatusCode . Forbidden ) ] // Student1 tries to edit Student2’s post
301- [ TestCase ( StudentEmail2 , StudentPassword2 , 32 , "Student2 updated own post" , HttpStatusCode . OK ) ] // Student2 edits their own post
302- [ TestCase ( StudentEmail2 , StudentPassword2 , 21 , "Student2 tried updating Teacher’s post" , HttpStatusCode . Forbidden ) ] // Student2 tries to edit Teacher’s post
303- [ TestCase ( StudentEmail1 , "Wrong!1" , 30 , "Invalid login attempt" , HttpStatusCode . Unauthorized ) ] // Unauthenticated user (wrong password)
303+ [ TestCase ( TeacherEmail , TeacherPassword , TeacherPostID , "Teacher updated own post" , HttpStatusCode . OK ) ] // Teacher edit their own post
304+ [ TestCase ( TeacherEmail , TeacherPassword , StudentPostID1 , "Teacher updated student’s post" , HttpStatusCode . OK ) ] // Teacher edits someone else’s post
305+ [ TestCase ( StudentEmail1 , StudentPassword1 , StudentPostID1 , "Student1 updated own post" , HttpStatusCode . OK ) ] // Student1 edits their own post
306+ [ TestCase ( StudentEmail1 , StudentPassword1 , StudentPostID2 , "Student1 tried updating Student2’s post" , HttpStatusCode . Forbidden ) ] // Student1 tries to edit Student2’s post
307+ [ TestCase ( StudentEmail2 , StudentPassword2 , StudentPostID2 , "Student2 updated own post" , HttpStatusCode . OK ) ] // Student2 edits their own post
308+ [ TestCase ( StudentEmail2 , StudentPassword2 , TeacherPostID , "Student2 tried updating Teacher’s post" , HttpStatusCode . Forbidden ) ] // Student2 tries to edit Teacher’s post
309+ [ TestCase ( StudentEmail1 , "Wrong!1" , StudentPostID1 , "Invalid login attempt" , HttpStatusCode . Unauthorized ) ] // Unauthenticated user (wrong password)
304310 [ TestCase ( TeacherEmail , TeacherPassword , 999999 , "Does not exist" , HttpStatusCode . NotFound ) ] // Post does not exist
305- [ TestCase ( TeacherEmail , TeacherPassword , 21 , "" , HttpStatusCode . BadRequest ) ] // Invalid content (empty string)
306- [ TestCase ( StudentEmail1 , StudentPassword1 , 34 , "" , HttpStatusCode . BadRequest ) ] // Invalid content (empty string)
311+ [ TestCase ( TeacherEmail , TeacherPassword , TeacherPostID , "" , HttpStatusCode . BadRequest ) ] // Invalid content (empty string)
312+ [ TestCase ( StudentEmail1 , StudentPassword1 , StudentPostID2 , "" , HttpStatusCode . BadRequest ) ] // Invalid content (empty string)
307313 public async Task UpdatePostById ( string userEmail , string password , int postId , string newContent , HttpStatusCode expected )
308314 {
309315
0 commit comments