def test_check_emp_wrong_password(self, input, db, fernet): input.side_effect = ['a', 'a'] mocksql = mock.Mock() db.sql_connection.return_value = mocksql mocksql.cursor.return_value = mocksql mocksql.execute.return_value.fetchall.return_value = [("aa")] assert login().check_emp() == False
def test_check_emp_username_not_found(self, input, db, fernet): input.side_effect = ['a', 'a'] mocksql = mock.Mock() db.sql_connection.return_value = mocksql mocksql.cursor.return_value = mocksql mocksql.execute.return_value.fetchall.return_value = [] assert login().check_emp() == False
def test_check_team_username_empty(self, input, db, fernet): input.side_effect = ['', ''] fernet.cipher_suite.return_value.decrypt.return_value = "pass" mocksql = mock.Mock() db.sql_connection.return_value = mocksql mocksql.cursor.return_value = mocksql mocksql.execute.return_value.fetchall.return_value = [] assert login().check_team() == False
def test_check_admin_wrong_password(self, input, db, fernet): input.side_effect = ['admin', 'pass'] fernet.cipher_suite.return_value.decrypt.return_value = "pass" mocksql = mock.Mock() db.sql_connection.return_value = mocksql mocksql.cursor.return_value = mocksql mocksql.execute.return_value.fetchall.return_value = [["pass", "pass"]] assert login().check_admin() == False
def main(self): """ This is like main page of AIMS console application,will give different options :return: True/False """ print('AIMS(Accident & Incident Management System)') ch = '' while ch != 4: print("MAIN MENU") print("1. ADMIN LOGIN") print("2. SUPERVISING TEAM LOGIN") print("3. EMPLOYEE LOGIN") print("4. EXIT") print("Select Your Option (1-4)") ch = input("Enter your choice: ") if ch == '1': login().check_admin() elif ch == '2': login().check_team() elif ch == '3': login().check_emp() elif ch == '4': return True else: print("Invalid choice")
def test_check_emp_failure(self, input, db, fernet): input.side_effect = ['admin', 'pass'] assert login().check_emp() == False