def test_show_table_menu_inout_out_of_index(self, mock_input, mock_raw_table): cursor = MockCursor() admin = Admin() mock_input.return_value = '2' result = admin.show_table_menu(cursor, [1], [2]) self.assertEqual(None, result) mock_raw_table.assert_called_once()
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()