@@ -328,41 +328,39 @@ throws_ok {
328328}
329329' DB::Exception::InvalidParameter' , ' updateCourseUser: an parameter with invalid value' ;
330330
331- # Delete a single user from a course.
332- my $deleted_user ;
333- my $dont_delete_users ; # Switch to not delete added users.
331+ # Delete a course user
332+ $user_rs -> deleteCourseUser(info => { course_name => ' Arithmetic' , username => ' quimby' });
334333
335- SKIP: {
336- skip ' delete added users' , 5 if $dont_delete_users ;
337-
338- my $deleted_course_user = $user_rs -> deleteCourseUser(info => { course_name => ' Arithmetic' , username => ' quimby' });
339- removeIDs($deleted_course_user );
340-
341- is_deeply($course_user_params , $deleted_course_user , ' deleteCourseUser: delete a user from a course' );
334+ # and check to ensure quimby was deleted.
335+ throws_ok {
336+ $user_rs -> getCourseUser(info => { course_name => ' Arithmetic' , username => ' quimby' });
337+ }
338+ ' DB::Exception::UserNotInCourse' , ' deleteCourseUser: delete a user from a course' ;
342339
343- $deleted_user = $user_rs -> deleteGlobalUser(info => { username => ' quimby' });
344- removeIDs($deleted_user );
340+ $user_rs -> deleteGlobalUser(info => { username => ' quimby' });
345341
346- is_deeply($user_params , $deleted_user , ' deleteGlobalUser: delete a user' );
342+ throws_ok {
343+ $user_rs -> getGlobalUser(info => { username => ' quimby' });
344+ }
345+ ' DB::Exception::UserNotFound' , ' deleteGlobalUser: delete a user' ;
347346
348- # deleteUser: Check that if the course doesn't exist, an error is thrown:
349- throws_ok {
350- $user_rs -> deleteCourseUser(info => { course_name => ' unknown_course' , username => ' barney' });
351- }
352- ' DB::Exception::CourseNotFound' , " deleteUser: the course doesn't exist" ;
347+ # deleteUser: Check that if the course doesn't exist, an error is thrown:
348+ throws_ok {
349+ $user_rs -> deleteCourseUser(info => { course_name => ' unknown_course' , username => ' barney' });
350+ }
351+ ' DB::Exception::CourseNotFound' , " deleteUser: the course doesn't exist" ;
353352
354- # deleteUser: Check that if the course exists, but the user not a member.
355- throws_ok {
356- $user_rs -> deleteCourseUser(info => { course_name => ' Arithmetic' , username => ' marge' });
357- }
358- ' DB::Exception::UserNotInCourse' , ' deleteUser: the user is not a member of the course' ;
353+ # deleteUser: Check that if the course exists, but the user not a member.
354+ throws_ok {
355+ $user_rs -> deleteCourseUser(info => { course_name => ' Arithmetic' , username => ' marge' });
356+ }
357+ ' DB::Exception::UserNotInCourse' , ' deleteUser: the user is not a member of the course' ;
359358
360- # deleteUser: Send in username_name instead of username
361- throws_ok {
362- $user_rs -> deleteCourseUser(info => { course_name => ' Arithmetic' , username_name => ' bart' });
363- }
364- ' DB::Exception::ParametersNeeded' , ' deleteUser: the incorrect information is passed in.' ;
359+ # deleteUser: Send in username_name instead of username
360+ throws_ok {
361+ $user_rs -> deleteCourseUser(info => { course_name => ' Arithmetic' , username_name => ' bart' });
365362}
363+ ' DB::Exception::ParametersNeeded' , ' deleteUser: the incorrect information is passed in.' ;
366364
367365# Check that the precalc users have not changed.
368366@precalc_users_from_db = $user_rs -> getCourseUsers(info => { course_name => ' Precalculus' }, merged => 1);
0 commit comments