Пример #1
0
    def accountEdit(self):
        mySetup = Project()

        # edit role
        mySetup.command("login King password1")
        self.assertEqual(mySetup.command("user edit Momo role=TA"),
                         "Successfully changed Momo role to TA",
                         "Test Failed. Role was not successfully changed")
Пример #2
0
    def Login(self):
        mySetup = Project()

        mySetup.command("login King password1")
        mySetup.command("user add perms=TA username=Lars password=password2")
        mySetup.command("logout")

        self.assertEqual(
            mySetup.command("login Lars password2"), "Login successful",
            "Test failed. Should not have been able to edit without logging in"
        )
Пример #3
0
 def courseSuccessAdd(self):
     mySetup = Project()
     mySetup.command("login King password1")
     self.assertEqual(mySetup.command("course add dept=CS cnum=251"),
                      "Course Added: CS-251",
                      "Test Failed. Course was not successfully added")
     mySetup.command("logout")
Пример #4
0
    def deleteAccount(self):
        mySetup = Project()

        mySetup.command("login King password1")
        self.assertEqual(mySetup.command("user delete Lars"),
                         "Lars successfully removed",
                         "User could not be removed successfully")
        mySetup.command("logout")
Пример #5
0
 def createUserSuccess(self):
     mySetup = Project()
     mySetup.command("login King")
     self.assertEqual(
         mySetup.command(
             "user add perms=student username=Momo password=Cram"),
         "Momo successfully added", "user was not successfully added")
     mySetup.command("logout")
Пример #6
0
    def accountChanges(self):
        mySetup = Project()

        mySetup.command("login King password1")
        self.assertEqual(
            mySetup.command("user edit Lars officehrs=9:00AM-10:30AM"),
            "Lars office hours successfully changed",
            "Test Failed. Nono should have been changed to TA")
        mySetup.command("logout")
Пример #7
0
    def Login(self):

        mySetup = Project()

        self.assertEqual(mySetup.command("login King password1"),
                         "Login successful", "Test failed. Could not log in")
Пример #8
0
    def editContactInfo(self):

        mySetup = Project()

        # create TA first
        mySetup.command("login King password1")
        mySetup.command("user add perms=TA username=Lars password=password2")
        mySetup.command("logout")

        # TA edits phone number
        mySetup.command("login Lars password2")
        self.assertEqual(
            mySetup.command("user edit phone=(414)883-4893"),
            "Lars successfully changed phone number to (414)883-4893",
            "Test failed. Unable to edit phone number")
        mySetup.command("logout")
Пример #9
0
    def successView(self):
        mySetup = Project()

        mySetup.command("login King password1")
        mySetup.command("course add CS-417")
        self.assertEqual(
            mySetup.command("course view CS-417"),
            "Course: CS-417\nSections: None\nInstructor: None\nTA: None, ",
            "Test failed. Course could not be viewed by Supervisor")

        # add users for next tests
        mySetup.command("user add perms=TA username=Lars password=password2")
        mySetup.command(
            "user add perms=administrator username=Sec password=password3")
        mySetup.command("user add perms=student username=Momo password=Cram")
        mySetup.command("user logout King")

        # Test view with TA
        mySetup.command("login Lars password2")
        self.assertEqual(
            mySetup.command("course view CS-417"),
            "Course: CS-417\nSections: None\nInstructor: None\nTA: None, ",
            "Test failed. Course could not be viewed by TA")
        mySetup.command("user logout Lars")

        # Test view with Student
        mySetup.command("login Momo Cram")
        self.assertEqual(
            mySetup.command("course view CS-417"),
            "Course: CS-417\nSections: None\nInstructor: None\nTA: None, ",
            "Test failed. Course could not be viewed by Student")
        mySetup.command("logout")

        # Test view with Administrator
        mySetup.command("login Sec password3")
        self.assertEqual(
            mySetup.command("course view CS-417"),
            "Course: CS-417\nSections: None\nInstructor: None\nTA: None, ",
            "Test failed. Course could not be viewed by Administrator")
        mySetup.command("logout")