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.ad1.edit_account("*****@*****.**", "phone", "123.456.7890"))

        tester = models.ModelPerson.objects.get(email="*****@*****.**")
        self.assertEqual(tester.phone, "123.456.7890")
        self.assertFalse(
            self.ad1.edit_account("*****@*****.**", "phone_number",
                                  "not a number"))
        self.assertFalse(
            self.ad1.edit_account("*****@*****.**", "phone_number", "1234"))
        self.assertFalse(
            self.ad1.edit_account("*****@*****.**", "phone_number",
                                  "1234567890987654"))
        self.assertFalse(
            self.ad1.edit_account("*****@*****.**", "phone_number",
                                  "414-414-4141"))
        self.assertFalse(
            self.ad1.edit_account("*****@*****.**", "phone_number",
                                  "(414)414-4141"))
        self.assertFalse(
            self.ad1.edit_account("*****@*****.**", "phone_number",
                                  "abc.abc.abcd"))
        self.assertFalse(
            self.ad1.edit_account("*****@*****.**", "phone_number",
                                  "1234.1234.1234"))
Esempio n. 2
0
    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")
Esempio n. 3
0
    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"))
Esempio n. 4
0
    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"))
Esempio n. 5
0
    def __init__(self, email, password, account_type):
        self.email = email
        self.password = password
        self.phone_number = "000.000.0000"
        self.name = "DEFAULT"
        self.type = account_type
        self.isLoggedOn = False

        try:
            find_email = models.ModelPerson.objects.get(email=email)
        except models.ModelPerson.DoesNotExist:
            find_email = "none"

        if find_email == "none":
            some_guy = models.ModelPerson()
            some_guy.email = self.email
            some_guy.password = self.password
            some_guy.name = self.name
            some_guy.phone = self.phone_number
            some_guy.type = self.type
            some_guy.isLoggedOn = self.isLoggedOn
            some_guy.save()