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.")
def test_signup_password_invalid_LowerOnly(self): cl = loginsignup.Signup() with mockInput("a"): with self.assertRaises(ValueError): cl.signup_password(tests=True)
def test_signup_password_invalid_EmptyString(self): cl = loginsignup.Signup() with mockInput(""): with self.assertRaises(ValueError): cl.signup_password(tests=True)
def test_signup_password_valid(self): cl = loginsignup.Signup() with mockInput("A1dfgt"): cl.signup_password(tests=True) self.assertTrue(cl.valid)
def test_signup_username_invalid_Empty(self): cl = loginsignup.Signup() with mockInput(""): with self.assertRaises(ValueError): cl.signup_username(tests=True)
def test_signup_username_valid(self): cl = loginsignup.Signup() with mockInput("username"): cl.signup_username() self.assertGreater(len(cl.username), 0)
def test_signup_email_invalid_alreadyUsed(self): cl = loginsignup.Signup() with mockInput("*****@*****.**"): with self.assertRaises(ValueError): cl.signup_email(tests=True)
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)
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)
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)
def test_signup_email_valid(self): cl = loginsignup.Signup() with mockInput("*****@*****.**"): cl.signup_email(tests=True) self.assertEqual(cl.i, 4)
def test_signup_ipbanned_unbanned(self): cl = loginsignup.Signup() cl.signup_checks("") self.assertFalse(cl.banned, msg="Current IP is resulting banned.")
def test_signup_ipbanned_banned(self): cl = loginsignup.Signup() cl.signup_checks("*") self.assertTrue(cl.banned)