def test_complete_member_project_exception(self, mock_db, mock_project_list, mock_print): mock_project_list.side_effect = sqlite3.Error gpm = GPM() gpm.complete_member_project() self.assertEqual(mock_print.call_count, 2) mock_db().rollback_data.assert_called_once()
def test_complete_member_project_back(self, mock_input, mock_menu, mock_project_list, mock_print): mock_project_list.return_value = {'project_name': 'project_id'} mock_menu().draw_menu.return_value = 'BACK' gpm = GPM() gpm.complete_member_project() mock_print.assert_called_once() mock_input.assert_called_once() mock_menu().draw_menu.assert_called_once() mock_project_list.assert_called_once()
def test_complete_member_project(self, mock_db, mock_input, mock_menu, mock_project_list, mock_delete_request, mock_print): mock_project_list.return_value = {'name': 'id'} mock_db().get_project_member_name.return_value = [[ 'member_id', 'member_name' ]] mock_menu().draw_menu.side_effect = ['name', 'member_name'] gpm = GPM() gpm.complete_member_project() mock_project_list.assert_called_once() self.assertEqual(mock_menu().draw_menu.call_count, 2) mock_db().commit_data.assert_called_once() mock_db().get_project_member_name.assert_called_once() mock_delete_request.assert_called_once()