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