コード例 #1
0
 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"
     )
コード例 #2
0
 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"
     )
コード例 #3
0
 def test_command_createAccount_permission_denied(self):
     LoginHelper.login(self.LH, ["login", "janewayk123", "123456"])
     self.assertEqual(
         self.UI.command("createAccount neelix45 TA [email protected]"),
         "You do not have the credentials to create an account. Permission denied"
     )
     LoginHelper.logout(self.LH)
コード例 #4
0
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())
コード例 #5
0
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())
コード例 #6
0
 def test_command_createLab_missing_begin(self):
     LoginHelper.login(self.LH, ["login", "kirkj22", "678543"])
     self.assertEqual(
         self.UI.command("createLab courseNumber labSection day end"),
         "Your command is missing arguments, please enter your command in the following format: "
         "createLab courseNumber labSectionNumber daysOfWeek beginTime endTime"
     )
コード例 #7
0
 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"
     )
コード例 #8
0
 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)
コード例 #9
0
 def setUp(self):
     Account.objects.create(userName='******', password='******')
     self.login = LoginHelper()
     self.Command1 = ["login", "hsimpson", "password"]
     self.Command2 = ["login", "hsimpson", "wrongPassword"]
     self.Command3 = ["login", "rob", "password"]
     self.Command4 = ["login", "hsimpson"]
     self.Command5 = ["login", "hsimpson", "password", "something"]
コード例 #10
0
 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")
コード例 #11
0
 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")
コード例 #12
0
 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")
コード例 #13
0
 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.")
コード例 #14
0
 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")
コード例 #15
0
 def setUp(self):
     self.login = LoginHelper()
     self.CUH = CurrentUserHelper()
     Account.objects.create(firstName='Homer',
                            userName='******',
                            password='******')
     Account.objects.create(firstName='Stu',
                            userName='******',
                            password='******')
コード例 #16
0
 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"
     )
コード例 #17
0
 def setUp(self):
     self.login = LoginHelper()
     self.CUH = CurrentUserHelper()
     self.CA = CreateAccount()
     self.CC = CreateCourse()
     self.CL = CreateLab()
     self.account1 = Account.objects.create(firstName='Homer',
                                            userName='******',
                                            password='******')
     self.account2 = Account.objects.create(firstName='Stu',
                                            userName='******',
                                            password='******')
     self.course1 = Course.objects.create(name='Eng',
                                          number='101',
                                          onCampus='True',
                                          classDays='W')
コード例 #18
0
 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")
コード例 #19
0
 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")
コード例 #20
0
 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")
コード例 #21
0
 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")
コード例 #22
0
 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")
コード例 #23
0
 def test_command_assignTALab_tooFew(self):
     LoginHelper.login(self.LH, ["login", "kirkj22", "678543"])
     self.assertEqual(
         self.UI.command("assignTALab username classNumber"),
         "Your command has an invalid number of arguments. Please enter your command in the following format: "
         "assignTALab username classNumber labSectionNumber")
コード例 #24
0
 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")
コード例 #25
0
 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.")
コード例 #26
0
 def test_command_assignTACourse_invalidCourse(self):
     LoginHelper.login(self.LH, ["login", "kirkj22", "678543"])
     self.assertEqual(self.UI.command("assignTACourse picard304 387"),
                      "Invalid course number.")
コード例 #27
0
 def test_command_assignTACourse_invalidTA(self):
     LoginHelper.login(self.LH, ["login", "kirkj22", "678543"])
     self.assertEqual(self.UI.command("assignTACourse picard305 351"),
                      "Invalid TA username.")
コード例 #28
0
 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")
コード例 #29
0
 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")
コード例 #30
0
 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")