예제 #1
0
파일: supervisor.py 프로젝트: riyaz489/AIMS
 def show_accident_complain(self):
     """
     this method is used to show supervisor accident complain.
     """
     cursor = self.conn.show_supervisor_accidents(self.supervisor_id)
     admin = Admin()
     temp_dict = dict()
     print('choose accident to send report')
     temp_dict['accident_id'] = admin.show_table_menu(cursor)
     if temp_dict['accident_id'] is None:
         return
     cursor = self.conn.show_members()
     print('choose eye witness')
     temp_dict['eye_witness'] = admin.show_table_menu(cursor)
     print('choose victims')
     victims = admin.choose_multiple_employee()
     print('choose culprit')
     temp_dict['victims'] = ''
     temp_dict['culprit'] = ''
     culprit = admin.choose_multiple_employee()
     if culprit != [] and culprit != None:
         temp_dict['culprit'] = ','.join(culprit)
     if victims != [] and victims != None:
         temp_dict['victims'] = ','.join(victims)
     temp_dict['submitted_by'] = self.supervisor_id
     temp_dict['reason'] = input('enter reason ')
     temp_dict['timing'] = input('enter accident timing ')
     temp_dict['submission_time'] = d.datetime.now()
     temp_dict['location'] = input('enter location of accident ')
     temp_dict['action_to_resolve'] = input('enter action to resolve ' )
     try:
         self.conn.register_supervisor_report(temp_dict)
         self.conn.commit_data()
         print('report submitted successfully.')
     except Exception as e:
         print('some error occured')
         print(e)
         self.conn.rollback_data()
예제 #2
0
파일: test_admin.py 프로젝트: riyaz489/AIMS
 def test_choose_multiple_employee_exception(self, mock_input, mock_raw_table, mock_db):
     mock_db().show_members().fetchall.return_value = [[1, 2, 3]]
     mock_input.return_value = 'asd,1,2'
     admin = Admin()
     result = admin.choose_multiple_employee()
     self.assertEqual(result, None)
예제 #3
0
파일: test_admin.py 프로젝트: riyaz489/AIMS
 def test_choose_multiple_employee(self, mock_input, mock_raw_table, mock_db):
     mock_db().show_members().fetchall.return_value = [[1, 2, 3]]
     mock_input.return_value = '0,1,2'
     admin = Admin()
     result = admin.choose_multiple_employee()
     assert result, [1]