def check_team(self): """ Login for Team :return: True/False """ team_name = input("Enter your Team name: ") # password = getpass.getpass('Enter your team password: '******'{}\'".format(team_name)).fetchall() connection.commit() cursor.close() if retrieve_password: if password.encode() == self.cipher_suite.decrypt(retrieve_password[0][6].encode()): supervising_team(retrieve_password[0][0]).selection() print("Access granted") return True print("wrong password") return False print("Team id not found") return False except Error as e: print(e) return False print("Password or team name is empty") return False
def test_check_complain_exist_success(self, db): mocksql = mock.Mock() db.sql_connection.return_value = mocksql mocksql.cursor.return_value = mocksql mocksql.execute.return_value.fetchall.return_value = [[ 'aa', 'aa', 'aa', 'aa', 'aa', 'aa', 'aa', 'aa', 'aa' ], ['aa', 'aa', 'aa', 'aa', 'aa', 'aa', 'aa', 'aa', 'aa']] assert supervising_team("UUID").check_complain_exist() == False
def test_check_complain_exist_success_report_empty(self, db, report_accident): report_accident.return_value = True mocksql = mock.Mock() db.sql_connection.return_value = mocksql mocksql.cursor.return_value = mocksql mocksql.execute.return_value.fetchall.side_effect = [["aka"], []] assert supervising_team("UUID").check_complain_exist() == True
def test_selection_choice_1(self, input, check): check.return_value = True input.side_effect = ['1', '2'] assert supervising_team("UUID").selection() == True
def test_check_complain_exist_failure(self, db): assert supervising_team("UUID").check_complain_exist() == False
def test_report_accident_failure(self, db): assert supervising_team( "d7807f77-ea14-4519-8f03-ef5e39be7e31").report_accident() == False
def test_report_accident_success_feedback(self, input, db): input.side_effect = [ '40', '20', 'fire breakout', 'root cause', '200', 'feedback' ] db.sql_connection.cursor.execute.fetchall.return_value = [()] assert supervising_team("UUID").report_accident() == True
def test_selection_choice_2(self, input): input.side_effect = ['234', '2'] assert supervising_team("UUID").selection() == True