示例#1
0
    def loginmenu(connection):
        Hub.clear()
        print(Fore.MAGENTA + "-" * 16, Fore.RESET + "LOGIN MENU" + Fore.MAGENTA, "-" * 16,Fore.RESET)
        print(" " * 16, f"{Fore.GREEN}1.{Fore.RESET}  LOGIN")
        print(" " * 16, f"{Fore.GREEN}2.{Fore.RESET}  SIGNUP")
        print(" " * 16, f"{Fore.GREEN}3.{Fore.RESET}  QUIT")

        while True:
            choice = input("  > ")
            if choice == "1":
                class_ = loginsignup.Login()
                login = class_.run()
                debug_print("Login:"******"":
                    connection.append(Connection(login))
                else:
                    error_print("Invalid Login")
                    Menu.loginmenu(connections)
                break
            elif choice == "2":
                class_ = loginsignup.Signup()
                class_.run()
                break
            elif choice == "3":
                quit(0)
            else:
                error_print("Invalid choice.")
示例#2
0
 def test_signup_password_invalid_LowerOnly(self):
     cl = loginsignup.Signup()
     with mockInput("a"):
         with self.assertRaises(ValueError):
             cl.signup_password(tests=True)
示例#3
0
 def test_signup_password_invalid_EmptyString(self):
     cl = loginsignup.Signup()
     with mockInput(""):
         with self.assertRaises(ValueError):
             cl.signup_password(tests=True)
示例#4
0
 def test_signup_password_valid(self):
     cl = loginsignup.Signup()
     with mockInput("A1dfgt"):
         cl.signup_password(tests=True)
         self.assertTrue(cl.valid)
示例#5
0
 def test_signup_username_invalid_Empty(self):
     cl = loginsignup.Signup()
     with mockInput(""):
         with self.assertRaises(ValueError):
             cl.signup_username(tests=True)
示例#6
0
 def test_signup_username_valid(self):
     cl = loginsignup.Signup()
     with mockInput("username"):
         cl.signup_username()
         self.assertGreater(len(cl.username), 0)
示例#7
0
 def test_signup_email_invalid_alreadyUsed(self):
     cl = loginsignup.Signup()
     with mockInput("*****@*****.**"):
         with self.assertRaises(ValueError):
             cl.signup_email(tests=True)
示例#8
0
 def test_signup_email_invalid_EndsWithDOT(self):
     cl = loginsignup.Signup()
     with mockInput("username@domain."):
         with self.assertRaises(ValueError):
             cl.signup_email(tests=True)
         self.assertEqual(cl.i, 3)
示例#9
0
 def test_signup_email_invalid_notAtSYMBOL(self):
     cl = loginsignup.Signup()
     with mockInput("username"):
         with self.assertRaises(ValueError):
             cl.signup_email(tests=True)
         self.assertEqual(cl.i, 2)
示例#10
0
 def test_signup_email_invalid_Empty(self):
     cl = loginsignup.Signup()
     with mockInput(""):
         with self.assertRaises(ValueError):
             cl.signup_email(tests=True)
         self.assertEqual(cl.i, 0)
示例#11
0
 def test_signup_email_valid(self):
     cl = loginsignup.Signup()
     with mockInput("*****@*****.**"):
         cl.signup_email(tests=True)
         self.assertEqual(cl.i, 4)
示例#12
0
 def test_signup_ipbanned_unbanned(self):
     cl = loginsignup.Signup()
     cl.signup_checks("")
     self.assertFalse(cl.banned, msg="Current IP is resulting banned.")
示例#13
0
 def test_signup_ipbanned_banned(self):
     cl = loginsignup.Signup()
     cl.signup_checks("*")
     self.assertTrue(cl.banned)