Beispiel #1
0
    def setUp(self):
        self.p = Project()

        #Setup TA users
        self.p.command("user add perms=TA username=ta1 password=password")
        self.p.command(
            "user add perms=TA username=ta2 password=password [email protected] pnumber=4142321232 address=123 Maryland Ave"
        )
Beispiel #2
0
    def setUp(self):
        self.p = Project()

        #Create users
        self.p.command(
            "user add perms=INSTRUCTOR username=instr1 password=password")
        self.p.command("user add perms=TA username=ta1 password=password")
        self.p.command(
            "user add perms=TA username=ta2 password=password [email protected]"
        )
Beispiel #3
0
    def test_admin_delete_accounts(self):
        p = Project()
        p.command("login admin1 password")
        #Adding
        self.assertEqual("User Added: JB", p.command("user add perms=TA username=JB password=123456789"))
        #Removing
        self.assertEqual("User Removed: JB", p.command("user remove username=JB"))
        #User should no longer exist
        self.assertEqual("User Does Not Exist: JB", p.command("user view username=JB"))

        p.command("logout")
Beispiel #4
0
    def test_admin_edit_accounts(self):
        p = Project()
        p.command("login admin1 password")
        #Adding user
        self.assertEqual("User Added: JB", p.command("user add perms=TA username=JB password=123456789"))
        #Editing user (including both existsing and missing attributes)
        self.assertEqual("User Modified: JB", p.command("user edit username=JB perms=Admin pnumber=4145557777"))
        #Proper display after updating
        self.assertEqual("Username: JB\nRoles(s): Admin\nPhone Number: 4145557777")

        p.command("logout")
Beispiel #5
0
    def test_admin_access(self):
        p = Project()
        p.command("login admin1 password")
        #Adding user with many public and private attributes
        self.command("User Added: JB", p.command("user add perms=TA username=JB password=123456789 pnumber=4147775555 address = 123 Kirkwood"))
        #Admins should be able to view all data a user has (private and public), save the password
        self.command("Username: JB\n Roles(s): TA\nPhone Number: 4147775555\nAddress: 123 Kirkwood")

        p.command("logout")
Beispiel #6
0
    def test_admin_create_accounts(self):
        p = Project()
        p.command("login admin1 password")
        #Adding users
        self.assertEqual("User Added: JB", p.command("user add perms=TA username=JB password=123456789"))
        #Proper Display, user has in fact been created
        self.assertEqual("Username: JB\nRole(s): TA")

        p.command("logout")
    def test_admin_email(self):
        p = Project()
        p.command("login admin1 password")
        #To be implemented

        p.command("logout")
    def test_admin_create_classes(self):
        p = Project()
        p.command("login admin1 password")
        #Using code and fields should both work!
        #Adding courses
        self.assertEqual("Course Added: CS-351",
                         p.command("course add CS-351"))
        self.assertEqual("Course Added: CS-317",
                         p.command("course add dept=CS cnum=317"))

        #Adding Sections
        self.assertEqual("Section Added: CS-351-401",
                         p.command("section add CS-351-401"))
        self.assertEqual("Section Added: CS-351-801",
                         p.command("section add dept=CS cnum=351 snum=801"))

        #Section can't exists if root course doesn't (No corresponding cnum)
        self.assertEqual("Can't Create Section, Course Doesn't Exist: CS-315",
                         p.command("section add CS-315-801"))

        #Proper display of courses
        self.assertEqual("Course: CS-351\nSection(s): 401, 801\n",
                         p.command("course view code=CS-351"))
        self.assertEqual("Course: CS-317\nSections(s): \n",
                         p.command("course view CS-317"))
 def setUp(self):
     self.p = Project()
     self.p.command("login admin1 password")
class MatthewTests(unittest.TestCase):

    # before each test
    def setUp(self):
        self.p = Project()
        self.p.command("login admin1 password")

    # after each test
    def tearDown(self):
        self.p.command("logout")
        del self.p

    # User Story #23 Supervisor: Assign instructor to course
    def test_supervisor_assign_instructor_to_course(self):
        # 60 check instructor added to course

        # Given a Supervisor
        self.assertEqual(
            "User Added: FOO",
            self.p.command("user add perms=SUPERVISOR username=FOO password=abc123")
        )

        # Given an Instructor
        self.assertEqual(
            "User Added: MATTHEW",
            self.p.command("user add perms=INSTRUCTOR username=MATTHEW password=abc123")
        )

        # Given a Course
        self.assertEqual(
            "Course Added: CS-351",
            self.p.command("course add CS-351")
        )

        # When Supervisor Logged In
        self.p.command("login FOO abc123")

        # When Course Given Instructor
        self.assertEqual(
            "Course Edited: CS-351",
            self.p.command("course edit CS-351 instructor=MATTHEW")
        )

        # Then Course Should Have Instructor
        self.assertEqual(
            "Course: CS-351\n Instructor: MATTHEW",
            self.p.command("course view code=CS-351")
        )


    # User Story #40 Instructor: Edit Contact Info
    def test_instructor_edit_contact_info(self):

        # Given an Instructor
        self.assertEqual(
            "User Added: MATTHEW",
            self.p.command("user add perms=INSTRUCTOR username=MATTHEW password=abc123")
        )

        # When User Logged In
        self.p.command("login MATTHEW abc123")

        # When Change Password
        self.assertEqual(
            "User Edit: MATTHEW",
            self.p.command("user add perms=INSTRUCTOR username=MATTHEW password=123abc")
        )

        # 61 check Contact information must reflect change
        self.assertEqual(
            "\nUsername: MATTHEW\nRole(s): INSTRUCTOR \nPassword: 123abc",
            self.p.command("user view username=MATTHEW")
        )


    # User Story #41 Instructor: View Assignments
    def test_instructor_view_assignments(self):

        # Given an Instructor
        self.assertEqual(
            "User Added: MATTHEW",
            self.p.command("user add perms=INSTRUCTOR username=MATTHEW password=abc123")
        )

        # Given a Course
        self.assertEqual(
            "Course Added: CS-351",
            self.p.command("course add CS-351 instructor=MATTHEW")
        )

        # When INSTRUCTOR Logged In
        self.p.command("login MATTHEW abc123")

        # 64 check correct course assignments are returned for the user
        self.assertEqual(
            "Course: CS-351\n Instructor: MATTHEW",
            self.p.command("course view code=CS-351")
        )



    # User Story #45 Instructor: Send notifications to TA
    def test_instructor_send_notifications_to_ta(self):
        # 76 Check User receives confirmation of correctly sent email

        # Later Implementation
        self.assertEqual(2 + 2, 4)

    # User Story #51 Instructor: Read public contact information for all users
    def test_instructor_get_contact_info(self):

        # Given an Instructor
        self.assertEqual(
            "User Added: MATTHEW",
            self.p.command("user add perms=INSTRUCTOR username=MATTHEW pnumber=1234567890 password=abc123")
        )

        # When User Logged In
        self.p.command("login MATTHEW abc123")

        # Fetch User
        result = self.p.command("user view username=MATTHEW")

        # Then User should have correct public info
        self.assertEqual(
            "\nUsername: MATTHEW\nRole(s): INSTRUCTOR \nPhone: 1234567890",
            result
        )

        # 85 Check Only public information should be returned
        self.assertFalse(
            result.__contains__("Password")
        )
Beispiel #11
0
class TestInstructor(unittest.TestCase):
    def setUp(self):
        self.p = Project()

        #Create users
        self.p.command(
            "user add perms=INSTRUCTOR username=instr1 password=password")
        self.p.command("user add perms=TA username=ta1 password=password")
        self.p.command(
            "user add perms=TA username=ta2 password=password [email protected]"
        )

    def tearDown(self):
        self.p.command("logout")

    # User Story #42 : Instructor: View TA assignments
    def test_instr_view_ta_assignments(self):
        self.p.command("login supervisor1 password")

        #Add course and assign TAs to sections
        self.p.command("course add dept=CS cnum=351 instructor=instr1")
        self.p.command("section add dept=CS cnum=351 snum=801")
        self.p.command("section edit code=CS-351-802 TA=ta2")
        self.p.command("logout")

        self.p.command("login instr1 password")

        #ta1 should have no assignments, ta2 is assigned to CS-351 Section 802
        self.assertEqual(
            "Username: ta1 \nRole(s): TA \nEmail: None \nAssignments: None",
            "user view ta1")
        self.assertEqual(
            "Username: ta2 \nRole(s): TA \nEmail:ta2uwm.edu \nAssignments: CS-351-802",
            "user view ta2")

    # User Story #43 : Instructor: Get TA email
    def test_instr_view_ta_email(self):
        self.p.command("login instr1 password")
        self.assertEqual(
            "Username: ta1 \nRole(s): TA \nEmail: None \nAssignments: None",
            "user view ta1")
        self.assertEqual(
            "Username: ta2 \nRole(s): TA \nEmail:ta2uwm.edu \nAssignments: CS-351-802",
            "user view ta2")

    # User Story #48 : Change TA lab section
    def test_instr_change_ta_lab(self):
        self.p.command("login supervisor1 password")

        #Add course and assign TAs to sections
        self.p.command("course add dept=CS cnum=351 instructor=instr1")
        self.p.command("section add dept=CS cnum=351 snum=801")
        self.p.command("section add dept=CS cnum=351 snum=802")
        self.p.command("section edit code=CS-351-802 TA=ta2")
        self.p.command("logout")

        self.p.command("login instr1 password")

        #Test changes to sections
        self.assertEqual("TA section changed.",
                         self.p.command("user edit ta2 snum=801"))
        self.assertEqual(
            "Username: ta2 \nRole(s): TA \nEmail:None \nAssignments: CS-351-801",
            self.p.command("user view ta2"))
        self.assertEqual("TA section changed.",
                         self.p.command("user edit ta2 snum=802"))
        self.assertEqual(
            "Username: ta2 \nRole(s): TA \nEmail:None \nAssignments: CS-351-802",
            self.p.command("user view ta2"))
Beispiel #12
0
class TestTA(unittest.TestCase):
    def setUp(self):
        self.p = Project()

        #Setup TA users
        self.p.command("user add perms=TA username=ta1 password=password")
        self.p.command(
            "user add perms=TA username=ta2 password=password [email protected] pnumber=4142321232 address=123 Maryland Ave"
        )

    def tearDown(self):
        self.p.command("logout")

    # User Story #25 : TA: View TA assignments
    def test_ta_view_ta_assignments(self):
        self.p.command("login supervisor1 password")

        #Add course and assign TAs to sections
        self.p.command("course add dept=CS cnum=351")
        self.p.command("section add dept=CS cnum=351 snum=801")
        self.p.command("section add dept=CS cnum=351 snum=802")
        self.p.command("section edit code=CS-351-801 TA=ta1")
        self.p.command("section edit code=CS-351-802 TA=ta2")
        self.p.command("logout")

        #Login to TA account
        self.p.command("login ta1 password")

        #View assignment of second TA
        self.assertEqual(
            "\nUsername: ta2\nRole(s): TA \nEmail: [email protected] \nAssignments: CS-351-802",
            self.p.command("user view ta2"))

        self.p.command("logout")

        #Log in to second ta
        self.p.command("login ta2 password")

        #View Ta1 assignments
        self.assertEqual(
            "\nUsername: ta1\nRole(s): TA \nEmail: None \nAssignments: CS-351-801",
            self.p.command("user view ta1"))

    # User Story #34 : TA: Read public contact information for all users
    def test_ta_read_public_info(self):
        self.p.command("login ta1 password")

        #Only display public info
        self.assertEqual("\nUsername: ta2\nRole(s): TA \nEmail: [email protected]",
                         self.p.command("user view ta2"))
	def setUp(self):
		p = Project() # It would be useful to have a way to specify working with a clean database in the constructor 
		p.command("login supervisor1 password")