def add_item(): title = request.form.get('title') app.logger.info("Add Item %s", title) if title != '': session.Boards().add_item(title) app.logger.info("Item Successfully Added by %s", current_user.id) return redirect('/')
def start_item(id): if (id != "favicon.ico"): app.logger.info("Start Item %s", id) todo_class = session.Boards() item = todo_class.get_item(id) item['status'] = "Doing" todo_class.save_item(item) app.logger.info("Item %s successfully Started.", id) return redirect('/')
def uncomplete_item(id): if (id != "favicon.ico"): app.logger.info("UnComplete Item %s", id) todo_class = session.Boards() item = todo_class.get_item(id) item['status'] = "Not Started" todo_class.save_item(item) app.logger.info("Item %s Set to unomplete.", id) return redirect('/')
def complete_item(id): if (id != "favicon.ico"): app.logger.info("Complete Item %s", id) todo_class = session.Boards() item = todo_class.get_item(id) item['status'] = "Completed" todo_class.save_item(item) app.logger.info("Item %s successfully Completed", id) return redirect('/')
def test_delete_item(driver, test_app): driver.get('http://localhost:5000/') driver.find_element(By.XPATH, '//details').click() remove_link = driver.find_element( By.XPATH, '//li[contains(text(), "selenium created new item")]/a') remove_link.click() driver.refresh() assert len( driver.find_elements( By.XPATH, '//li[contains(text(), "selenium created new item")]')) == 0 session.Boards().delete_trello_board(os.environ['TRELLO_BOARD_ID'])
def test_app(): # Create the new board & update the board id environment variable file_path = find_dotenv('.env') load_dotenv(file_path) board_id = session.Boards().create_trello_board() os.environ['TRELLO_BOARD_ID'] = board_id # construct the new application application = app.create_app() application.config['LOGIN_DISABLED'] = True # start the app in its own thread. thread = Thread(target=lambda: application.run(use_reloader=False)) thread.daemon = True thread.start() yield app # Tear Down thread.join(1)
def index(): app.logger.debug("Index start") items = session.Boards().get_items() item_view_model = session.ViewModel(items) if app.config.get("LOGIN_DISABLED", False): mcurrent_user = '' misWriter = True #for E2E testing else: mcurrent_user = current_user.username misWriter = (appsession.get('roles') == ROLES['writer']) app.logger.info("Is Writer %s", misWriter) app.logger.debug("Index end") return render_template('index.html', view_model=item_view_model, isWriter=misWriter, currentuser=mcurrent_user)
def delete_item(id): app.logger.info("Remove Item %s", id) todo_class = session.Boards() todo_class.remove_item(id) app.logger.info("Item %s successfully Removed.", id) return redirect('/')