Ejemplo n.º 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"
     )
Ejemplo n.º 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"
     )
Ejemplo n.º 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)
Ejemplo n.º 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())
Ejemplo n.º 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())
Ejemplo n.º 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"
     )
Ejemplo n.º 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"
     )
Ejemplo n.º 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)
Ejemplo n.º 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"]
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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.")
Ejemplo n.º 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")
Ejemplo n.º 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='******')
Ejemplo n.º 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"
     )
Ejemplo n.º 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')
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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.")
Ejemplo n.º 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.")
Ejemplo n.º 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.")
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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")