def test_command_createLab_permission_denied(self): LoginHelper.login(self.LH, ["login", "janewayk123", "123456"]) self.assertEqual( self.UI.command("createLab courseNumber labSection day begin end"), "You do not have the credentials to create a lab. Permission denied" ) LoginHelper.logout(self.LH)
def test_command_createCourse_invalid_days(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual( self.UI.command( "createCourse StellarCartography 456 Campus Wg7 1650 1830"), "Invalid days of the week, please enter days in the format: MWTRF or NN for online" )
def test_command_deleteAccount_permission_denied(self): LoginHelper.login(self.LH, ["login", "janewayk123", "123456"]) self.assertEqual( self.UI.command("deleteAccount neelix45 TA"), "You do not have the credentials to delete an account. Permission denied" ) LoginHelper.logout(self.LH)
def test_command_createCourse_permission_denied(self): LoginHelper.login(self.LH, ["login", "janewayk123", "123456"]) self.assertEqual( self.UI.command( "createCourse SoftwareEngineering 361 Campus TR 1000 1050"), "You do not have the credentials to create a course. Permission denied" )
def test_command_createCourse_no_args(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual( self.UI.command("createCourse"), "Your command is missing arguments, please enter your command in the following form: " "createCourse courseName courseNumber onCampus daysOfWeek start end" )
class TestLoginLogout(TestCase): def setUp(self): self.login = LoginHelper() self.CUH = CurrentUserHelper() Account.objects.create(firstName='Homer', userName='******', password='******') Account.objects.create(firstName='Stu', userName='******', password='******') def test00(self): self.assertEqual(self.login.login(["login", "Homer", "123456"]), "Account Not Found") self.assertFalse(self.CUH.isCurrent()) self.assertEqual(self.login.login(["login", "hsimpson", "123456"]), "Logged in as hsimpson") self.assertTrue(self.CUH.isCurrent()) def test01(self): self.assertFalse(self.CUH.isCurrent()) self.assertEqual(self.login.login(["login", "hsimpson", '123456']), "Logged in as hsimpson") self.assertTrue(self.CUH.isCurrent()) self.assertEqual(self.login.logout(), "Successfully logged out") self.assertFalse(self.CUH.isCurrent())
def test_command_assignTALab_tooMany(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual( self.UI.command( "assignTALab userName classNumber labsection classNum"), "Your command has an invalid number of arguments. Please enter your command in the following format: " "assignTALab username classNumber labSectionNumber")
def test_command_createLab_missing_end(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual( self.UI.command("createLab courseNumber labSection day begin"), "Your command is missing arguments, please enter your command in the following format: " "createLab courseNumber labSectionNumber daysOfWeek beginTime endTime" )
def test_command_assignInstructorCourse_permission_denied(self): LoginHelper.login(self.LH, ["login", "janewayk123", "123456"]) self.assertEqual( self.UI.command("assigninstructorcourse cheng41 535"), "You do not have the credentials to assign an instructor to a course. Permission denied" ) LoginHelper.logout(self.LH)
def test_command_createLab_invalid_times(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("createLab 784 204 M kalj 1700"), "Invalid start or end time, please use a 4 digit military time representation") self.assertEqual(self.UI.command("createLab 784 204 M 8909 1700"), "Invalid start or end time, please use a 4 digit military time representation") self.assertEqual(self.UI.command("createLab 784 204 M 1400 17"), "Invalid start or end time, please use a 4 digit military time representation")
def test_command_createLab_invalid_days(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("createLab 784 204 qrs 1600 1700"), "Invalid days of the week, please enter days in the format: MWTRF") self.assertEqual(self.UI.command("createLab 784 204 89TR 1600 1700"), "Invalid days of the week, please enter days in the format: MWTRF") self.assertEqual(self.UI.command("createLab 784 204 JHG 1600 1700"), "Invalid days of the week, please enter days in the format: MWTRF")
def test_command_createLab_invalid_sectNum(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("createLab 784 909089 M 1600 1700"), "Section number must be numeric and three digits long") self.assertEqual(self.UI.command("createLab 784 rug M 1600 1700"), "Section number must be numeric and three digits long") self.assertEqual(self.UI.command("createLab 784 kku23k M 1600 1700"), "Section number must be numeric and three digits long")
def test_command_createAccount_invalid_email(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("createAccount crusherw31 TA [email protected]"), "The email address you have entered in not valid. Please make sure you are using a uwm email " "address in the correct format.") self.assertEqual(self.UI.command("createAccount crusherw31 TA crusherw31"), "The email address you have entered in not valid. Please make sure you are using a uwm email " "address in the correct format.")
def test_command_createLab_invalid_courseNum(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("createLab 7aa 204 M 1600 1700"), "Course number must be numeric and three digits long") self.assertEqual(self.UI.command("createLab 90872 204 M 1600 1700"), "Course number must be numeric and three digits long") self.assertEqual(self.UI.command("createLab tro 204 M 1600 1700"), "Course number must be numeric and three digits long")
def test_command_createCourse_invalid_times(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual( self.UI.command( "createCourse StellarCartography 456 Campus MW 9800 1830"), "Invalid start or end time, please use a 4 digit military time representation" ) self.assertEqual( self.UI.command( "createCourse StellarCartography 456 Campus MW 1830 4444"), "Invalid start or end time, please use a 4 digit military time representation" )
class TestCreateAccountLogin(TestCase): def setUp(self): self.CUH = CurrentUserHelper() self.CA = CreateAccount() self.LH = LoginHelper() def test00(self): self.assertEqual( self.CA.createAccount( ["createaccount", "hsimpson", "ta", "*****@*****.**"]), "Account successfully created. Temporary password is: hsimpson456" ) self.assertFalse(self.CUH.isCurrent()) self.assertEqual(self.LH.login(["login", "hsimpson", "hsimpson456"]), "Logged in as hsimpson") self.assertTrue(self.CUH.isCurrent()) self.assertEqual(self.CUH.getCurrentUserTitle(), 1) self.assertEqual(self.CUH.getCurrentUser(), Account.objects.get()) self.assertEqual(self.LH.logout(), "Successfully logged out") self.assertFalse(self.CUH.isCurrent())
def test_command_viewCourseAssignments_instoneAssign(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("viewcourseassign cheng41"), "cheng41 is assigned to: Algorithms")
def test_command_viewCourseAssignments_TAnoAssign(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("viewcourseassign picard304"), "picard304 does not have any assignments")
def test_command_viewCourseAssignments_instnoAssign(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("viewcourseassign janewayk123"), "janewayk123 does not have any assignments")
def test_command_assignTALav_invalidLab(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("assignTALab taman 351 801"), "Invalid lab section")
def test_command_assignTALab_invalidCourse(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("assigntalab taman 111 804"), "Invalid course number")
def test_command_assignTALab_success(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) TACourse.objects.create(TA=self.tamanAccount, Course=self.datastructures) self.assertEqual(self.UI.command("assignTALab taman 351 804"), "TA successfully assigned")
def test_command_assignTACourse_noArgs(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual( self.UI.command("assignTACourse"), "Your command has an incorrect number of arguments, please enter your command in the following format: " "assignTACourse userName classNumber")
def test_command_assignTACourse_invalidTitle(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("assignTACourse janewayk123 351"), "Account is not a TA.")
def test_command_assignTACourse_invalidCourse(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("assignTACourse picard304 387"), "Invalid course number.")
def test_command_assignTACourse_invalidTA(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("assignTACourse picard305 351"), "Invalid TA username.")
def test_command_assignTACourse_success(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("assignTACourse picard304 351"), "Assignment successful.")
def test_command_viewCourseAssignments_TAoneAssign(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("viewcourseassign taman"), "taman is assigned to: DiscreteMath")
def test_command_viewCourseAssignments_invalidTitle(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual( self.UI.command("viewcourseassign kirkj22"), "Only Ta and Instructor accounts can have Assignments")
def test_command_assingInstructorCourse_course_doesNotExist(self): LoginHelper.login(self.LH, ["login", "kirkj22", "678543"]) self.assertEqual(self.UI.command("assigninstructorcourse bob15 999"), "Invalid course number")