Exemple #1
0
    def create_account(self, parse_cmd):
        # Jeff's method
        # calls create_account for admin and supervisor

        some_guy = self.whos_logged_in()

        if len(parse_cmd) != 4:
            return "Parameter error."

        if some_guy.type == "administrator":
            admin = Administrator(some_guy.email, some_guy.password,
                                  some_guy.type)
            did_work = admin.create_account(parse_cmd[1], parse_cmd[2],
                                            parse_cmd[3])
        elif some_guy.type == "supervisor":
            sup = Supervisor(some_guy.email, some_guy.password, some_guy.type)
            did_work = sup.create_account(parse_cmd[1], parse_cmd[2],
                                          parse_cmd[3])
        else:
            return "Invalid command."

        if did_work:
            return "Account created!"
        else:
            return "Account creation error."
Exemple #2
0
 def test_change_password(self):
     self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
     self.assertTrue(self.Supervisor1.change_password("password"))
     self.assertEquals(self.Supervisor1.password, "password")
     self.assertNotEquals(self.Supervisor1.password, "DEFAULT_PASSWORD")
     model_person1 = models.ModelPerson.objects.get(email=self.Supervisor1.email)
     self.assertEquals(model_person1.password, "password")
Exemple #3
0
 def test_change_name(self):
     self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
     self.Supervisor1.change_name("Snoop Doggy Dog")
     model_person1 = models.ModelPerson.objects.get(email=self.Supervisor1.email)
     self.assertEquals(model_person1.name, "Snoop Doggy Dog")
     self.assertEquals(self.Supervisor1.name, "Snoop Doggy Dog")
     self.assertNotEquals(self.Supervisor1.name, "DEFAULT")
Exemple #4
0
    def assign_instructor(self, parse_cmd):
        if len(parse_cmd) != 3:
            return "Incorrect Command"
        temp = self.whos_logged_in()
        if temp.type == "administrator" or temp.type == "instructor" or temp.type == "ta":
            return "Access Denied"
        some_guy = Supervisor(temp.email, temp.password, temp.type)
        try:
            check_ins = models.ModelPerson.objects.get(email=parse_cmd[1],
                                                       type="instructor")
        except models.ModelPerson.DoesNotExist:
            check_ins = None
        if check_ins is None:
            return "no such instructor"
        try:
            check_course = models.ModelCourse.objects.get(
                course_id=parse_cmd[2])
        except models.ModelCourse.DoesNotExist:
            check_course = None
        if check_course is None:
            return "no such course"

        if some_guy.assign_instructor(check_ins, check_course):
            return "command successful"
        else:
            return "command unsuccessful"
Exemple #5
0
    def assign_ta(self, parse_cmd):
        if len(parse_cmd) != 3:
            return "Incorrect Command"
        temp = self.whos_logged_in()
        if temp is None:
            return "Incorrect Command"
        if temp.type != "supervisor":
            return "Access Denied"
        try:
            check_ta = models.ModelPerson.objects.get(email=parse_cmd[1],
                                                      type="ta")
        except models.ModelPerson.DoesNotExist:
            check_ta = None
        if check_ta is None:
            return "no such ta"
        try:
            check_course = models.ModelCourse.objects.get(
                course_id=parse_cmd[2])
        except models.ModelCourse.DoesNotExist:
            check_course = None
        if check_course is None:
            return "no such course"

        some_guy = Supervisor(temp.email, temp.password, temp.type)
        if some_guy.assign_ta_course(check_ta, check_course):
            return "command successful"
        else:
            return "command unsuccessful"
Exemple #6
0
 def test_login(self):
     self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
     self.assertEquals(Supervisor.login("*****@*****.**", "DEFAULT_PASSWORD"), "Login successful")
     model_supervisor1 = models.ModelPerson.objects.get(email=self.Supervisor1.email)
     self.assertTrue(model_supervisor1.isLoggedOn)
     self.assertEquals(Supervisor.login("*****@*****.**", "DEFAULT_PASSWORD"), "User already logged in")
     self.assertEquals(Supervisor.login("*****@*****.**", "password"), "User already logged in")
Exemple #7
0
class GetContactInfo(unittest.TestCase):
    def setUp(self):
        self.ADMIN = Administrator("*****@*****.**", "adminPass")
        self.ADMIN.change_name("Dave Brubeck")
        self.ADMIN.change_phone(4141234567)

        self.SUPER = Supervisor("*****@*****.**", "superPass")
        self.SUPER.change_name("Donna Summer")
        self.SUPER.change_phone(4149876543)

        self.INSTR = Instructor("*****@*****.**", "instrPass")
        self.INSTR.change_name("Dean Martin")
        self.INSTR.change_phone(2621234567)

        self.T_AYY = TA("*****@*****.**", "t_ayyPass")
        self.T_AYY.change_name("Daniel Craig")
        self.T_AYY.change_phone(2629876543)

    def test_get_info_admin(self):
        self.ui.command("Login [email protected] adminPass")
        self.assertEqual(
            self.ui.command("get_contact_info"),
            "NAME           PHONE           EMAIL"
            "Dave Brubeck   414.123.4567    [email protected]"
            "Donna Summer   414.987.6543    [email protected]"
            "Dean Martin    262.123.4567    [email protected]"
            "Daniel Craig   262.987.6543    [email protected]")

    def test_get_info_super(self):
        self.ui.command("Login [email protected] adminPass")
        self.assertEqual(
            self.ui.command("get_contact_info"),
            "NAME           PHONE           EMAIL"
            "Dave Brubeck   414.123.4567    [email protected]"
            "Donna Summer   414.987.6543    [email protected]"
            "Dean Martin    262.123.4567    [email protected]"
            "Daniel Craig   262.987.6543    [email protected]")

    def test_get_info_inst(self):
        self.ui.command("Login [email protected] instrPass")
        self.assertEqual(
            self.ui.command("get_contact_info"),
            "NAME           PHONE           EMAIL"
            "Dave Brubeck   414.123.4567    [email protected]"
            "Donna Summer   414.987.6543    [email protected]"
            "Dean Martin    262.123.4567    [email protected]"
            "Daniel Craig   262.987.6543    [email protected]")

    def test_get_info_ta(self):
        self.ui.command("Login [email protected] t_ayyPass")
        self.assertEqual(
            self.ui.command("get_contact_info"),
            "NAME           PHONE           EMAIL"
            "Dave Brubeck   414.123.4567    [email protected]"
            "Donna Summer   414.987.6543    [email protected]"
            "Dean Martin    262.123.4567    [email protected]"
            "Daniel Craig   262.987.6543    [email protected]")
Exemple #8
0
 def test_change_email(self):
     self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
     self.person2 = Person("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
     self.Supervisor1.change_email("*****@*****.**")
     model_person1 = models.ModelPerson.objects.get(email=self.Supervisor1.email)
     self.assertEquals(model_person1.email, "*****@*****.**")
     self.assertEquals(self.Supervisor1.email, "*****@*****.**")
     self.assertNotEquals(self.Supervisor1.email, "*****@*****.**")
     self.assertFalse(self.Supervisor1.change_email("*****@*****.**"))
     self.assertFalse(self.Supervisor1.change_email("no_at_symbol_or_dot_something"))
     self.assertFalse(self.Supervisor1.change_email("*****@*****.**"))
Exemple #9
0
 def test_change_phone(self):
     self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
     self.Supervisor1.change_phone("414.414.4141")
     model_person1 = models.ModelPerson.objects.get(email=self.Supervisor1.email)
     self.assertEquals(model_person1.phone, "414.414.4141")
     self.assertEquals(self.Supervisor1.phone_number, "414.414.4141")
     self.assertNotEquals(self.Supervisor1.phone_number, "000.000.0000")
     self.assertFalse(self.Supervisor1.change_phone("1234567890"))
     self.assertFalse(self.Supervisor1.change_phone("414-414-4141"))
     self.assertFalse(self.Supervisor1.change_phone("(414)414-4141"))
     self.assertFalse(self.Supervisor1.change_phone("abc.abc.abcd"))
     self.assertFalse(self.Supervisor1.change_phone("1234.1234.1234"))
Exemple #10
0
    def setUp(self):
        self.SUP = Supervisor("*****@*****.**", "SUP")
        self.ADMIN = Administrator("*****@*****.**", "ADMIN")
        self.INS = Instructor("*****@*****.**", "INS")
        self.TA = TA("*****@*****.**", "TA")

        """
    def setUp(self):
        self.ADMIN = Administrator("*****@*****.**", "adminPass")
        self.ADMIN.change_name("Dave Brubeck")
        self.ADMIN.change_phone(4141234567)

        self.SUPER = Supervisor("*****@*****.**", "superPass")
        self.SUPER.change_name("Donna Summer")
        self.SUPER.change_phone(4149876543)

        self.INSTR = Instructor("*****@*****.**", "instrPass")
        self.INSTR.change_name("Dean Martin")
        self.INSTR.change_phone(2621234567)

        self.T_AYY = TA("*****@*****.**", "t_ayyPass")
        self.T_AYY.change_name("Daniel Craig")
        self.T_AYY.change_phone(2629876543)
 def test_assign_ta_lab_not_ta(self):
         # test against non-TAs
         self.SUP = Supervisor("*****@*****.**", "SUP")
         self.ADMIN = Administrator("*****@*****.**", "ADMIN")
         self.INS = Instructor("*****@*****.**", "INS")
         self.assertEqual(self.ui.command("assign_ta_lab [email protected] 801"), "Error: [email protected] is not a TA")
         self.assertEqual(self.ui.command("assign_ta_lab [email protected] 801"), "Error: [email protected] is not a TA")
         self.assertEqual(self.ui.command("assign_ta_lab [email protected] 801"), "Error: [email protected] is not a TA")
Exemple #13
0
 def setUp(self):
     self.SUP = Supervisor("*****@*****.**", "SUP")
     self.ADMIN = Administrator("*****@*****.**", "ADMIN")
     self.INS = Instructor("*****@*****.**", "INS")
     self.TA = TA("*****@*****.**", "TA")
     self.Course1 = Course("CS351", 3)
     self.Course2 = Course("CS431", 2)
     self.Course3 = Course("CS361", 3)
class AccessInfoTests(unittest.TestCase):
    def setUp(self):
        self.ADMIN = Administrator("*****@*****.**", "adminPass")
        self.ADMIN.change_name("Dave Brubeck")
        self.ADMIN.change_phone(4141234567)

        self.SUPER = Supervisor("*****@*****.**", "superPass")
        self.SUPER.change_name("Donna Summer")
        self.SUPER.change_phone(4149876543)

        self.INSTR = Instructor("*****@*****.**", "instrPass")
        self.INSTR.change_name("Dean Martin")
        self.INSTR.change_phone(2621234567)

        self.T_AYY = TA("*****@*****.**", "t_ayyPass")
        self.T_AYY.change_name("Daniel Craig")
        self.T_AYY.change_phone(2629876543)

    def test_valid_access_admin(self):
        self.ui.command("Login [email protected] adminPass")
        self.assertEqual(
            self.ui.command("AccessInfo"),
            "NAME           PHONE           EMAIL           PASSWORD"
            "Dave Brubeck   414.123.4567    [email protected]   adminPass"
            "Donna Summer   414.987.6543    [email protected]   superPass"
            "Dean Martin    262.123.4567    [email protected]   instrPass"
            "Daniel Craig   262.987.6543    [email protected]   t_ayyPass")

    def test_valid_access_super(self):
        self.ui.command("Login [email protected] superPass")
        self.assertEqual(
            self.ui.command("AccessInfo"),
            "NAME           PHONE           EMAIL           PASSWORD"
            "Dave Brubeck   414.123.4567    [email protected]   adminPass"
            "Donna Summer   414.987.6543    [email protected]   superPass"
            "Dean Martin    262.123.4567    [email protected]   instrPass"
            "Daniel Craig   262.987.6543    [email protected]   t_ayyPass")

    def test_invalid_access_instr(self):
        self.ui.command("Login [email protected] instrPass")
        self.assertEqual(self.ui.command("AccessInfo"), "Access Denied")

    def test_invalid_access_ta(self):
        self.ui.command("Login [email protected] t_ayyPass")
        self.assertEqual(self.ui.command("AccessInfo"), "Access Denied")
Exemple #15
0
 def setup(self):
     self.Sup = Supervisor("*****@*****.**", "SupervisorPassword")
     self.Admin = Administrator("*****@*****.**", "AdministratorPassword")
     self.Inst = Instructor("*****@*****.**", "InstructorPassword")
     self.Inst2 = Instructor("*****@*****.**", "InstructorPassword2")
     self.TA = TA("*****@*****.**", "TAPassword")
     self.Course1 = Course("SomeCSClass1", 1)
     self.Course2 = Course("SomeCSClass2", 2)
     self.Course3 = Course("SomeCSClass3", 3)
 def setUp(self):
     self.TA1 = TA("*****@*****.**", "ta1Pass")
     self.TA2 = TA("*****@*****.**", "ta2Pass")
     self.TA3 = TA("*****@*****.**", "ta3Pass")
     self.INS = Instructor("*****@*****.**", "insPass")
     self.SUP = Supervisor("*****@*****.**", "supPass")
     self.ADMIN = Administrator("*****@*****.**", "adminPass")
     self.COURSE1 = Course("CS101", 2)
     self.COURSE2 = Course("CS222", 2)
Exemple #17
0
    def access_info(self, parse_cmd):
        # Jeff's method
        # calls access_info for admin and supervisor

        info = "Invalid command."
        some_guy = self.whos_logged_in()

        if len(parse_cmd) != 1 or some_guy is None:
            return info

        if some_guy.type == "administrator":
            admin = Administrator(some_guy.email, some_guy.password,
                                  some_guy.type)
            info = admin.access_info()
        elif some_guy.type == "supervisor":
            sup = Supervisor(some_guy.email, some_guy.password, some_guy.type)
            info = sup.access_info()

        return info
Exemple #18
0
 def create_course(self, parse_cmd):
     current_user = self.whos_logged_in()
     if len(parse_cmd) != 3:
         return "Command not of the right format: [create_course CS###-### #]"
     if not parse_cmd[2].isdigit():
         return "An error occurred"
     if current_user.type == "administrator":
         adm = Administrator(current_user.email, current_user.password,
                             current_user.type)
         if adm.create_course(parse_cmd[1], int(parse_cmd[2])):
             return "Course has been created successfully."
         else:
             return "An error occurred"
     elif current_user.type == "supervisor":
         sup = Supervisor(current_user.email, current_user.password,
                          current_user.type)
         if sup.create_course(parse_cmd[1], int(parse_cmd[2])):
             return "Course has been created successfully."
         else:
             return "An error occurred"
     else:
         return "Yeah, you don't have access to that command. Nice try buddy."
Exemple #19
0
    def edit_account(self, parse_cmd):
        # Jeff's method
        # calls edit_account for admin and supervisor

        current_user = self.whos_logged_in()
        fail_string = "Invalid command"

        if current_user.type != "administrator" and current_user.type != "supervisor":
            return fail_string

        if len(parse_cmd) < 4:
            return fail_string

        if parse_cmd[2] == "name" and len(parse_cmd) > 3:
            i = 4
            while i < len(parse_cmd):
                parse_cmd[3] = parse_cmd[3] + " " + parse_cmd[i]
                i = i + 1
        else:
            if len(parse_cmd) != 4:
                return fail_string

        if current_user.type == "administrator":
            admin1 = Administrator(current_user.email, current_user.password,
                                   current_user.type)
            did_work = admin1.edit_account(parse_cmd[1], parse_cmd[2],
                                           parse_cmd[3])
        else:
            super1 = Supervisor(current_user.email, current_user.password,
                                current_user.type)
            did_work = super1.edit_account(parse_cmd[1], parse_cmd[2],
                                           parse_cmd[3])

        if did_work:
            return "Command successful."
        else:
            return "Command error."
    def setUp(self):
        self.sup = Supervisor("*****@*****.**", "sup_pass")

        # fake instructors
        self.ins1_courses = []
        self.ins1 = "*****@*****.**"
        self.ins2_courses = []
        self.ins2 = "*****@*****.**"
        # fake course
        self.course1_tas = []
        self.course1_instructor = ""
        self.course1 = ("CS101", 2)
        self.course2_tas = []
        self.course2_instructor = ""
        self.course2 = ("CS202", 0)
        # fake ta
        self.ta1_sections = []
        self.ta1_course = ""
        self.ta1 = "*****@*****.**"
        self.ta2_sections = []
        self.ta2_course = ""
        self.ta2 = "*****@*****.**"
        self.ta3 = "ta3.uwm.edu"
        self.ta3_course = ""
Exemple #21
0
 def setup(self):
     new_admin = Administrator("*****@*****.**", "password",
                               "administrator")
     new_super = Supervisor("*****@*****.**", "password",
                            "supervisor")
     return "Admin/Supervisor accounts setup!"
class TestSupervisor(TestCase):
    def setUp(self):
        self.sup = Supervisor("*****@*****.**", "sup_pass")

        # fake instructors
        self.ins1_courses = []
        self.ins1 = "*****@*****.**"
        self.ins2_courses = []
        self.ins2 = "*****@*****.**"
        # fake course
        self.course1_tas = []
        self.course1_instructor = ""
        self.course1 = ("CS101", 2)
        self.course2_tas = []
        self.course2_instructor = ""
        self.course2 = ("CS202", 0)
        # fake ta
        self.ta1_sections = []
        self.ta1_course = ""
        self.ta1 = "*****@*****.**"
        self.ta2_sections = []
        self.ta2_course = ""
        self.ta2 = "*****@*****.**"
        self.ta3 = "ta3.uwm.edu"
        self.ta3_course = ""

    def test_assign_instructor_course(self):
        # instructor 1 is assigned CS101
        self.sup.assign_instructor(self.ins1, self.course1[0])
        self.assertEqual(self.ins1_courses[0], "CS101")
        self.assertEqual(self.course1_instructor, "*****@*****.**")

        # assign instructor 1 another course
        self.sup.assign_instructor(self.ins1, self.course2[0])
        self.assertEqual(self.ins1_courses[1], "CS202")
        self.assertEqual(self.course2_instructor, "*****@*****.**")

        # instructor 2 is assigned CS101
        self.sup.assign_instructor(self.ins2, self.course1[0])
        self.assertEqual(self.ins2_courses[0], "CS101")
        self.assertEqual(self.course1_instructor, "*****@*****.**")
        self.assertNotEqual(self.ins1_courses[0], "CS101")

        self.assertRaises(self.sup.assign_instructor(self.ta1, self.course1[0]), TypeError)

    def test_assign_ta_course(self):
        # TA 1 is assigned CS101
        self.sup.assign_ta_course(self.ta1, self.course1[0])
        self.assertEqual(self.ta1_course, "CS101")
        self.assertEqual(self.course1_tas[0], "*****@*****.**")

        # assign TA 1 another course
        self.sup.assign_ta_course(self.ta1, self.course2[0])
        self.assertEqual(self.ta1_course, "CS202")
        self.assertEqual(self.course2_tas[0], "*****@*****.**")

        # TA 2 is assigned CS101
        self.sup.assign_ta_course(self.ta2, self.course1[0])
        self.assertEqual(self.ta2_course, "CS101")
        self.assertEqual(self.course1_tas[1], "*****@*****.**")
        self.assertEqual(self.course1_tas[0], "*****@*****.**")

        # Try to assign a third TA to CS101
        self.sup.assign_ta_course(self.ta3, self.course1[0])
        self.assertNotEqual(self.ta3_course, "CS101")
        self.assertNotEqual(self.course1_tas[2], "*****@*****.**")

        self.assertRaises(self.sup.assign_ta_course(self.ins1, self.course1[0]), TypeError)

    def test_assign_ta_lab(self):
        # TA 1 is assigned CS101 - 801
        self.sup.assign_ta_lab(self.ta1, "CS101", 801)
        self.assertEqual(self.ta1_sections[0], 801)

        # TA 2 is assigned CS101 - 802
        self.sup.assign_ta_lab(self.ta2, 802)
        self.assertEqual(self.ta2_sections[0], "CS101")

        # Try to assign TA 1 another lab section
        self.assertRaises(self.sup.assign_ta_lab(self.ta1, self.course2[0]), OverflowError)

        self.assertRaises(self.sup.assign_ta_lab(self.ins1, self.course1[0]), TypeError)
Exemple #23
0
 def setUp(self):
     self.ad1 = Administrator("*****@*****.**", "ad1pass", "administrator")
     self.sup1 = Supervisor("*****@*****.**", "sup1pass", "supervisor")
Exemple #24
0
class TestSupervisor(TestCase):

    def setUp(self):
        self.ad1 = Administrator("*****@*****.**", "ad1pass", "administrator")
        self.sup1 = Supervisor("*****@*****.**", "sup1pass", "supervisor")

    def test_assign_instructor_course(self):
        # fake instructors
        self.ins1 = Instructor("*****@*****.**", "blah", "instructor")
        self.ins2 = Instructor("*****@*****.**", "inspass", "instructor")
        # fake course
        self.course1 = Course("CS101", 2)
        self.course2 = Course("CS202", 0)
        # instructor 1 is assigned CS101
        self.assertTrue(self.sup1.assign_instructor(self.ins1, self.course1))
        # self.assertEqual(self.ins1.courses[0], self.course1)
        self.assertEqual(self.course1.instructor.email, "*****@*****.**")

        # assign instructor 1 another course
        self.assertTrue(self.sup1.assign_instructor(self.ins1, self.course2))
        # self.assertEqual(self.ins1.courses[1], self.course2)
        self.assertEqual(self.course2.instructor.email, "*****@*****.**")

        # instructor 2 is assigned CS101
        self.assertTrue(self.sup1.assign_instructor(self.ins2, self.course1))
        # self.assertEqual(self.ins2.courses[0], self.course1)
        self.assertEqual(self.course1.instructor.email, "*****@*****.**")
        # self.assertNotEqual(self.ins1.courses[0], self.course1)

        self.ta1 = TA("*****@*****.**", "beh", "TA")
        with self.assertRaises(TypeError):
            self.sup1.assign_instructor(self.ta1, self.course1)

        self.admin1 = Administrator("*****@*****.**", "admin1", "administrator")
        with self.assertRaises(TypeError):
            self.sup1.assign_instructor(self.admin1, self.course1)

        with self.assertRaises(TypeError):
            self.sup1.assign_instructor(self.sup1, self.course1)

        with self.assertRaises(AttributeError):
            self.sup1.assign_instructor(self.ins1, "CS301-111")

        with self.assertRaises(AttributeError):
            self.sup1.assign_instructor("*****@*****.**", self.course1)

        self.sup1.create_course("CS337-401", 3)
        da_course = models.ModelCourse.objects.get(course_id="CS337-401")
        # self.test_course = Course(da_course.course_id, da_course.num_labs)
        # self.sup.assign_instructor(self.ins1, self.test_course)
        da_courseaa = models.ModelCourse.objects.get(course_id="CS337-401")
        self.assertEquals(da_courseaa.num_labs, da_course.num_labs)
        self.assertEquals(da_courseaa.course_id, da_course.course_id)
        # self.assertEquals(da_courseaa.instructor, self.ins1.email)

    def test_assign_ta_course(self):
        # TA 1 is assigned CS101
        # fake instructors
        self.ta1 = TA("*****@*****.**", "blah", "ta")
        self.ta2 = TA("*****@*****.**", "inspass", "ta")
        self.ta3 = TA("*****@*****.**", "pass3", "ta")
        # fake course
        self.course1 = Course("CS101-301", 2)
        self.course2 = Course("CS202-201", 0)
        # instructor 1 is assigned CS101
        self.assertTrue(self.sup1.assign_ta_course(self.ta1, self.course1))
       # self.assertEqual(self.course1.tee_ays[0], "*****@*****.**")
        db_ta_course = models.ModelTACourse.objects.get(course=models.ModelCourse.objects.get(course_id="CS101-301"), TA=models.ModelPerson.objects.get(email="*****@*****.**"))
        self.assertEqual(db_ta_course.TA, models.ModelPerson.objects.get(email="*****@*****.**"))
        self.assertEqual(db_ta_course.course, models.ModelCourse.objects.get(course_id="CS101-301"))

        # assign TA 1 another course
        self.assertTrue(self.sup1.assign_ta_course(self.ta1, self.course2))
        #self.assertEqual(self.course1.tee_ays[0], "*****@*****.**")
        db_ta_course = models.ModelTACourse.objects.get(course=models.ModelCourse.objects.get(course_id="CS202-201"),
                                                        TA=models.ModelPerson.objects.get(email="*****@*****.**"))
        self.assertEqual(db_ta_course.TA, models.ModelPerson.objects.get(email="*****@*****.**"))
        self.assertEqual(db_ta_course.course, models.ModelCourse.objects.get(course_id="CS202-201"))

        # TA 2 is assigned CS101
        self.assertTrue(self.sup1.assign_ta_course(self.ta2, self.course1))
        #self.assertEqual(self.course1.tee_ays[0], "*****@*****.**")
        db_ta_course = models.ModelTACourse.objects.get(course=models.ModelCourse.objects.get(course_id="CS101-301"),
                                                        TA=models.ModelPerson.objects.get(email="*****@*****.**"))
        self.assertEqual(db_ta_course.TA, models.ModelPerson.objects.get(email="*****@*****.**"))
        self.assertEqual(db_ta_course.course, models.ModelCourse.objects.get(course_id="CS101-301"))

        # Try to assign a third TA to CS101
        self.assertTrue(self.sup1.assign_ta_course(self.ta3, self.course1))
        #self.assertEqual(self.course1.tee_ays[0], "*****@*****.**")
        db_ta_course = models.ModelTACourse.objects.get(course=models.ModelCourse.objects.get(course_id="CS101-301"),
                                                        TA=models.ModelPerson.objects.get(email="*****@*****.**"))
        self.assertEqual(db_ta_course.TA, models.ModelPerson.objects.get(email="*****@*****.**"))
        self.assertEqual(db_ta_course.course, models.ModelCourse.objects.get(course_id="CS101-301"))

        self.admin1 = Administrator("*****@*****.**", "admin1", "administrator")
        with self.assertRaises(TypeError):
            self.sup1.assign_ta_course(self.admin1, self.course1)

        with self.assertRaises(TypeError):
            self.sup1.assign_ta_course(self.sup1, self.course1)

        self.ins1 = Instructor("*****@*****.**", "ins11111", "instructor")
        with self.assertRaises(TypeError):
            self.sup1.assign_ta_course(self.ins1, self.course1)

        with self.assertRaises(AttributeError):
            self.sup1.assign_ta_course(self.ta1, "CS301-111")

        with self.assertRaises(AttributeError):
            self.sup1.assign_ta_course("*****@*****.**", self.course1)

    def test_assign_ta_lab(self):
        # TA 1 is assigned CS101 - 801
        self.sup1.assign_ta_lab(self.ta1, "CS101", 801)
        self.assertEqual(self.ta1_sections[0], 801)

        # TA 2 is assigned CS101 - 802
        self.sup1.assign_ta_lab(self.ta2, 802)
        self.assertEqual(self.ta2_sections[0], "CS101")

        # Try to assign TA 1 another lab section
        self.assertRaises(self.sup1.assign_ta_lab(self.ta1, self.course2[0]), OverflowError)

        self.assertRaises(self.sup1.assign_ta_lab(self.ins1, self.course1[0]), TypeError)

    def test_create_course_as_supervisor(self):
        # create a new course as admin
        self.assertTrue(self.sup1.create_course("CS361-401", 3))
        # get the added course from the db
        da_course = models.ModelCourse.objects.get(course_id="CS361-401")
        # make sure found course is the same
        self.assertEqual(da_course.course_id, "CS361-401")
        self.assertEqual(da_course.num_labs, 3)
        self.assertEqual(da_course.instructor, "*****@*****.**")

    def test_create_course_again(self):
        self.assertTrue(self.sup1.create_course("CS361-401", 3))
        # create the same course again with no changes
        self.assertFalse(self.sup1.create_course("CS361-401", 3))
        # create the same course with a different number of labs
        self.assertFalse(self.sup1.create_course("CS361-401", 2))
        # create the same course with a different section number (technically a new course)
        self.assertTrue(self.sup1.create_course("CS361-402", 3))
        da_course = models.ModelCourse.objects.get(course_id="CS361-402")
        # make sure found course is the same
        self.assertEqual(da_course.course_id, "CS361-402")
        self.assertEqual(da_course.num_labs, 3)
        self.assertEqual(da_course.instructor, "*****@*****.**")

    def test_create_course_missing_parameters(self):
        with self.assertRaises(TypeError):
            self.sup1.create_course("CS101-401")
        # missing course_id/wrong type
        with self.assertRaises(TypeError):
            self.sup1.create_course(3)

    def test_create_course_long_course_id(self):
        # course_id too long and not right format
        self.assertFalse(self.sup1.create_course("totally_a_good_course_id", 2))

    def test_create_course_course_id_incorrect(self):
        # course_id missing CS at beginning
        self.assertFalse(self.sup1.create_course("123456789", 2))
        # course_id does not start with uppercase CS
        self.assertFalse(self.sup1.create_course("cs361-401", 2))
        # course_id doesn't have only numbers for course number
        self.assertFalse(self.sup1.create_course("CS3F4-321", 2))
        # course_id doesn't have a hyphen to separate course number and section number
        self.assertFalse(self.sup1.create_course("CS3611234", 2))
        # course_id doesn't have only numbers for section number
        self.assertFalse(self.sup1.create_course("CS361-1F3", 2))

    def test_create_course_bad_num_sections(self):
        # number of sections too big
        self.assertFalse(self.sup1.create_course("CS361-401", 99))
        # number of sections is less than 0
        self.assertFalse(self.sup1.create_course("CS361-401", -1))

    # Create Account Tests Start
    # created by Jeff
    def test_create_account_instructor(self):
        # Create Instructor Tests
        # create unused instructor account
        self.assertTrue(self.sup1.create_account("*****@*****.**", "better_password", "instructor"))
        # get account that was just setup
        test_model_ins = models.ModelPerson.objects.get(email="*****@*****.**")
        # make sure email is equal
        self.assertEqual(test_model_ins.email, "*****@*****.**")
        # make sure password is equal
        self.assertEqual(test_model_ins.password, "better_password")
        # default name test
        self.assertEqual(test_model_ins.name, "DEFAULT")
        # default phone test
        self.assertEqual(test_model_ins.phone, "000.000.0000")
        # login false test
        self.assertFalse(test_model_ins.isLoggedOn)

    def test_create_account_TA(self):
        # Create TA Tests
        # create unused ta account
        self.assertTrue(self.sup1.create_account("*****@*****.**", "santa_bro", "ta"))
        # get account
        test_model_ta = models.ModelPerson.objects.get(email="*****@*****.**")
        # test email
        self.assertEqual(test_model_ta.email, "*****@*****.**")
        # test password
        self.assertEqual(test_model_ta.password, "santa_bro")
        # default name test
        self.assertEqual(test_model_ta.name, "DEFAULT")
        # default phone test
        self.assertEqual(test_model_ta.phone, "000.000.0000")
        # login false test
        self.assertFalse(test_model_ta.isLoggedOn)

    # Invalid account type tests
    def test_create_account_supervisor(self):
        # create supervisor test
        self.assertFalse(self.sup1.create_account("*****@*****.**", "super1", "supervisor"))
        # not in db
        with self.assertRaises(models.ModelPerson.DoesNotExist):
            models.ModelPerson.objects.get(email="*****@*****.**")

    def test_create_account_administrator(self):
        # create admin test
        self.assertFalse(self.sup1.create_account("*****@*****.**", "labyrinth", "administrator"))
        # not in db
        with self.assertRaises(models.ModelPerson.DoesNotExist):
            models.ModelPerson.objects.get(email="*****@*****.**")

    def test_create_account_other(self):
        # create whatever test
        self.assertFalse(self.sup1.create_account("*****@*****.**", "not_today", "horse"))
        # not in db
        with self.assertRaises(models.ModelPerson.DoesNotExist):
            models.ModelPerson.objects.get(email="*****@*****.**")

    # Invalid parameter tests
    def test_create_account_invalid_parameter_no_email(self):
        # no email
        with self.assertRaises(TypeError):
            self.sup1.create_account("password", "instructor")

    def test_create_account_invalid_parameter_no_password(self):
        # no password
        with self.assertRaises(TypeError):
            self.sup1.create_account("*****@*****.**", "instructor")

    def test_create_account_invalid_parameter_no_account_type(self):
        # no account type
        with self.assertRaises(TypeError):
            self.sup1.create_account("*****@*****.**", "password3")

    def test_create_account_invalid_parameter_non_uwm_email(self):
        # non uwm email
        self.assertFalse(self.sup1.create_account("*****@*****.**", "happy_trees", "instructor"))
        # not in db
        with self.assertRaises(models.ModelPerson.DoesNotExist):
            models.ModelPerson.objects.get(email="*****@*****.**")

    def test_create_account_invalid_parameter_weird_email(self):
        # weird email, props to Grant for this test
        self.assertFalse(self.sup1.create_account("[email protected]@uwm.edu", "lotta_bob", "instructor"))
        # not in db
        with self.assertRaises(models.ModelPerson.DoesNotExist):
            models.ModelPerson.objects.get(email="[email protected]@uwm.edu")

    def test_create_account_invalid_parameter_not_an_email_addy(self):
        # not really an email addy
        self.assertFalse(self.sup1.create_account("TRUST_ME_IM_EMAIL", "seriously_real_address", "ta"))
        # not in db
        with self.assertRaises(models.ModelPerson.DoesNotExist):
            models.ModelPerson.objects.get(email="TRUST_ME_IM_EMAIL")

    def test_create_account_invalid_parameter_wrong_arg_types(self):
        # int args
        self.assertFalse(self.sup1.create_account(7, 8, 9))
        with self.assertRaises(models.ModelPerson.DoesNotExist):
            models.ModelPerson.objects.get(email=7)

    def test_create_account_invalid_parameter_taken_email(self):
        # email taken
        self.sup1.create_account("*****@*****.**", "santa_bro", "ta")
        self.assertFalse(self.sup1.create_account("*****@*****.**", "santa_bro", "ta"))

    # Create Account Tests End

    def test_edit_account_password(self):
        # create a test user in the system
        tester = models.ModelPerson()
        tester.email = "*****@*****.**"
        tester.password = "******"
        tester.save()
        # test edit password
        self.sup1.edit_account("*****@*****.**", "password", "new_pass")

        tester = models.ModelPerson.objects.get(email="*****@*****.**")
        self.assertEqual(tester.password, "new_pass")

    def test_edit_account_email(self):
        # create a test user in the system
        tester = models.ModelPerson()
        tester.email = "*****@*****.**"
        tester.password = "******"
        tester.save()
        # test edit email
        self.sup1.edit_account("*****@*****.**", "email", "*****@*****.**")

        with self.assertRaises(models.ModelPerson.DoesNotExist):
            models.ModelPerson.objects.get(email="*****@*****.**")
        tester = models.ModelPerson.objects.get(email="*****@*****.**")
        self.assertEqual(tester.email, "*****@*****.**")
        self.assertFalse(self.sup1.edit_account("*****@*****.**", "email", "[email protected]@uwm.edu"))
        self.assertFalse(self.sup1.edit_account("*****@*****.**", "email", "*****@*****.**"))
        self.assertFalse(self.sup1.edit_account("*****@*****.**", "email", "badEmail"))

    def test_edit_account_phone(self):
        # create a test user in the system
        tester = models.ModelPerson()
        tester.email = "*****@*****.**"
        tester.password = "******"
        tester.save()
        # test edit phone
        self.assertTrue(self.sup1.edit_account("*****@*****.**", "phone", "123.456.7890"))

        tester = models.ModelPerson.objects.get(email="*****@*****.**")
        self.assertEqual(tester.phone, "123.456.7890")
        self.assertFalse(self.sup1.edit_account("*****@*****.**", "phone_number", "not a number"))
        self.assertFalse(self.sup1.edit_account("*****@*****.**", "phone_number", "1234"))
        self.assertFalse(self.sup1.edit_account("*****@*****.**", "phone_number", "1234567890987654"))
        self.assertFalse(self.sup1.edit_account("*****@*****.**", "phone_number", "414-414-4141"))
        self.assertFalse(self.sup1.edit_account("*****@*****.**", "phone_number", "(414)414-4141"))
        self.assertFalse(self.sup1.edit_account("*****@*****.**", "phone_number", "abc.abc.abcd"))
        self.assertFalse(self.sup1.edit_account("*****@*****.**", "phone_number", "1234.1234.1234"))

    def test_edit_account_name(self):
        # create a test user in the system
        tester = models.ModelPerson()
        tester.email = "*****@*****.**"
        tester.password = "******"
        tester.save()
        # test edit name
        self.sup1.edit_account("*****@*****.**", "name", "Howard Stern")

        tester = models.ModelPerson.objects.get(email="*****@*****.**")
        self.assertEqual(tester.name, "Howard Stern")
        self.assertFalse(self.sup1.edit_account("*****@*****.**", "password", "new_pass"))
        self.assertFalse(self.sup1.edit_account("*****@*****.**", "wrong_field", "new_pass"))

    def test_delete_account(self):
        self.deleted_user = ("*****@*****.**", "delete_me_pass")
        self.sup1.delete_account("*****@*****.**")
        self.copy_user = ("*****@*****.**", "delete_me_pass")
        self.assertNotEqual(self.copy_user, self.deleted_user)

    def test_send_notification(self):
        self.assertTrue(self.sup1.send_notification("I Like To Eat French Fries In The Rain"))

    # Access Info Tests Start
    # Jeff's tests
    def test_access_info_admin_title(self):
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[0], "Administrator:")

    def test_access_info_admin_(self):
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[1], "DEFAULT | [email protected] | 000.000.0000")

    def test_access_info_blank_one(self):
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[2], "")

    def test_access_info_sup_title(self):
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[3], "Supervisor:")

    def test_access_info_sup(self):
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[4], "DEFAULT | [email protected] | 000.000.0000")

    def test_access_info_blank_two(self):
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[5], "")

    def test_access_info_inst_title(self):
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[6], "Instructors:")

    def test_access_info_blank_three(self):
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[7], "")

    def test_access_info_ta_title(self):
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[8], "TAs:")

    def test_access_info_blank_four(self):
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[9], "")

    def test_access_info_course_title(self):
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[10], "Courses:")

    def test_access_info_inst_no_course(self):
        # Add instructor, no course assignments
        self.inst1 = Instructor("*****@*****.**", "password", "instructor")
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[7], "DEFAULT | [email protected] | 000.000.0000")

    def test_access_info_ta_no_course(self):
        # Add TA, no course assignments
        self.ta1 = TA("*****@*****.**", "password", "ta")
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[9], "DEFAULT | [email protected] | 000.000.0000")

    def test_access_info_inst_one_course(self):
        # Instructor with a course
        self.inst1 = Instructor("*****@*****.**", "password", "instructor")
        self.course1 = Course("CS101", 0)
        self.course1.instructor = "*****@*****.**"
        mod_course1 = models.ModelCourse.objects.get(course_id="CS101")
        mod_course1.instructor = "*****@*****.**"
        mod_course1.save()
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[8], "\tCourse: CS101")

    def test_access_info_ta_one_course(self):
        # TA with a course
        self.ta1 = TA("*****@*****.**", "password", "ta")
        mod_ta_course1 = models.ModelTACourse()
        self.course1 = Course("CS101", 0)
        mod_course1 = models.ModelCourse.objects.get(course_id="CS101")
        mod_ta_course1.course = mod_course1
        mod_ta1 = models.ModelPerson.objects.get(email="*****@*****.**")
        mod_ta_course1.TA = mod_ta1
        mod_ta_course1.save()
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[10], "\tCourse: CS101")

    def test_access_info_course(self):
        # just a course
        self.course1 = Course("CS101", 0)
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[11], "CS101")

    def test_access_info_all_the_things(self):
        # ALL THE THINGS
        self.inst1 = Instructor("*****@*****.**", "password", "instructor")
        self.inst2 = Instructor("*****@*****.**", "password", "instructor")
        self.ta1 = TA("*****@*****.**", "password", "ta")
        self.ta2 = TA("*****@*****.**", "password", "ta")
        self.course1 = Course("CS101", 0)
        self.course2 = Course("CS102", 0)
        self.course1.instructor = "*****@*****.**"
        mod_course1 = models.ModelCourse.objects.get(course_id="CS101")
        mod_course1.instructor = "*****@*****.**"
        mod_course1.save()
        self.course2.instructor = "*****@*****.**"
        mod_course2 = models.ModelCourse.objects.get(course_id="CS102")
        mod_course2.instructor = "*****@*****.**"
        mod_course2.save()
        mod_ta_course1 = models.ModelTACourse()
        mod_ta_course1.course = mod_course1
        mod_ta1 = models.ModelPerson.objects.get(email="*****@*****.**")
        mod_ta_course1.TA = mod_ta1
        mod_ta_course1.save()
        mod_ta_course2 = models.ModelTACourse()
        mod_ta_course2.course = mod_course2
        mod_ta2 = models.ModelPerson.objects.get(email="*****@*****.**")
        mod_ta_course2.TA = mod_ta2
        mod_ta_course2.save()
        access_info = self.sup1.access_info()
        parse_info = access_info.split("\n")
        self.assertEqual(parse_info[0], "Administrator:")
        self.assertEqual(parse_info[1], "DEFAULT | [email protected] | 000.000.0000")
        self.assertEqual(parse_info[2], "")
        self.assertEqual(parse_info[3], "Supervisor:")
        self.assertEqual(parse_info[4], "DEFAULT | [email protected] | 000.000.0000")
        self.assertEqual(parse_info[5], "")
        self.assertEqual(parse_info[6], "Instructors:")
        self.assertEqual(parse_info[7], "DEFAULT | [email protected] | 000.000.0000")
        self.assertEqual(parse_info[8], "\tCourse: CS101")
        self.assertEqual(parse_info[9], "")
        self.assertEqual(parse_info[10], "DEFAULT | [email protected] | 000.000.0000")
        self.assertEqual(parse_info[11], "\tCourse: CS102")
        self.assertEqual(parse_info[12], "")
        self.assertEqual(parse_info[13], "")
        self.assertEqual(parse_info[14], "TAs:")
        self.assertEqual(parse_info[15], "DEFAULT | [email protected] | 000.000.0000")
        self.assertEqual(parse_info[16], "\tCourse: CS101")
        self.assertEqual(parse_info[17], "")
        self.assertEqual(parse_info[18], "DEFAULT | [email protected] | 000.000.0000")
        self.assertEqual(parse_info[19], "\tCourse: CS102")
        self.assertEqual(parse_info[20], "")
        self.assertEqual(parse_info[21], "")
        self.assertEqual(parse_info[22], "Courses:")
        self.assertEqual(parse_info[23], "CS101")
        self.assertEqual(parse_info[24], "CS102")
    # Access Info Tests End
    # Person tests

    def test_init_(self):
        self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
        self.assertEquals(self.Supervisor1.email, "*****@*****.**")
        self.assertEquals(self.Supervisor1.password, "DEFAULT_PASSWORD")

    def test_change_password(self):
        self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
        self.assertTrue(self.Supervisor1.change_password("password"))
        self.assertEquals(self.Supervisor1.password, "password")
        self.assertNotEquals(self.Supervisor1.password, "DEFAULT_PASSWORD")
        model_person1 = models.ModelPerson.objects.get(email=self.Supervisor1.email)
        self.assertEquals(model_person1.password, "password")

    def test_change_email(self):
        self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
        self.person2 = Person("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
        self.Supervisor1.change_email("*****@*****.**")
        model_person1 = models.ModelPerson.objects.get(email=self.Supervisor1.email)
        self.assertEquals(model_person1.email, "*****@*****.**")
        self.assertEquals(self.Supervisor1.email, "*****@*****.**")
        self.assertNotEquals(self.Supervisor1.email, "*****@*****.**")
        self.assertFalse(self.Supervisor1.change_email("*****@*****.**"))
        self.assertFalse(self.Supervisor1.change_email("no_at_symbol_or_dot_something"))
        self.assertFalse(self.Supervisor1.change_email("*****@*****.**"))

    def test_change_phone(self):
        self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
        self.Supervisor1.change_phone("414.414.4141")
        model_person1 = models.ModelPerson.objects.get(email=self.Supervisor1.email)
        self.assertEquals(model_person1.phone, "414.414.4141")
        self.assertEquals(self.Supervisor1.phone_number, "414.414.4141")
        self.assertNotEquals(self.Supervisor1.phone_number, "000.000.0000")
        self.assertFalse(self.Supervisor1.change_phone("1234567890"))
        self.assertFalse(self.Supervisor1.change_phone("414-414-4141"))
        self.assertFalse(self.Supervisor1.change_phone("(414)414-4141"))
        self.assertFalse(self.Supervisor1.change_phone("abc.abc.abcd"))
        self.assertFalse(self.Supervisor1.change_phone("1234.1234.1234"))

    def test_change_name(self):
        self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
        self.Supervisor1.change_name("Snoop Doggy Dog")
        model_person1 = models.ModelPerson.objects.get(email=self.Supervisor1.email)
        self.assertEquals(model_person1.name, "Snoop Doggy Dog")
        self.assertEquals(self.Supervisor1.name, "Snoop Doggy Dog")
        self.assertNotEquals(self.Supervisor1.name, "DEFAULT")

    def test_get_contact_info(self):
        self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
        self.assertEquals(self.Supervisor1.get_contact_info(), "Snoop Doggy Dog, [email protected], 4144244343")
        self.assertNotEquals(self.Supervisor1.get_contact_info(), "DEFAULT, [email protected], 0000000000")

    def test_login(self):
        self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
        self.assertEquals(Supervisor.login("*****@*****.**", "DEFAULT_PASSWORD"), "Login successful")
        model_supervisor1 = models.ModelPerson.objects.get(email=self.Supervisor1.email)
        self.assertTrue(model_supervisor1.isLoggedOn)
        self.assertEquals(Supervisor.login("*****@*****.**", "DEFAULT_PASSWORD"), "User already logged in")
        self.assertEquals(Supervisor.login("*****@*****.**", "password"), "User already logged in")

    def test_logout(self):
        self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
        self.assertEquals(Supervisor.login("*****@*****.**", "DEFAULT_PASSWORD"), "Login successful")
        self.assertTrue(self.Supervisor1.logout())
Exemple #25
0
 def test_logout(self):
     self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
     self.assertEquals(Supervisor.login("*****@*****.**", "DEFAULT_PASSWORD"), "Login successful")
     self.assertTrue(self.Supervisor1.logout())
Exemple #26
0
 def __init__(self):
     self.administrator = Administrator("*****@*****.**", "admin_password")
     self.supervisor = Supervisor("*****@*****.**", "super_password")
     self.instructors = []
     self.tas = []
     self.courses = []
Exemple #27
0
 def test_get_contact_info(self):
     self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
     self.assertEquals(self.Supervisor1.get_contact_info(), "Snoop Doggy Dog, [email protected], 4144244343")
     self.assertNotEquals(self.Supervisor1.get_contact_info(), "DEFAULT, [email protected], 0000000000")
 def setup(self):
     self.Sup = Supervisor("*****@*****.**", "SupervisorPassword")
     self.Admin = Administrator("*****@*****.**", "AdministratorPassword")
     self.Inst = Instructor("*****@*****.**", "InstructorPassword")
     self.TA = TA("*****@*****.**", "TAPassword")
 def setup(self):
     self.TA = TA("*****@*****.**", "taPass")
     self.INS = Instructor("*****@*****.**", "insPass")
     self.SUP = Supervisor("*****@*****.**", "supPass")
     self.ADMIN = Administrator("*****@*****.**", "adminPass")
Exemple #30
0
 def test_init_(self):
     self.Supervisor1 = Supervisor("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT")
     self.assertEquals(self.Supervisor1.email, "*****@*****.**")
     self.assertEquals(self.Supervisor1.password, "DEFAULT_PASSWORD")