def update( card_id: int, owner: str = typer.Option(None, "-o", "--owner", help="change the card owner"), priority: int = typer.Option( None, "-p", "--priority", help="change the card priority", ), summary: List[str] = typer.Option( None, "-s", "--summary", help="change the card summary", ), done: bool = typer.Option(None, "-d", "--done", help="change the card done state"), ): """Modify a card in db with given id with new info.""" set_cards_db_path() summary = " ".join(summary) if summary else None cards.update_card(card_id, cards.Card(summary, owner, priority, done))
def update_card(card_id): """Update an existing card, the JSON payload may be partial""" if not request.is_json: abort(400) # TODO: handle errors cards.update_card(card_id, request.get_json(), app.config.get('kanban.columns')) return 'Success'
def test_update(db_non_empty): # GIVEN a card known to be in the db all_cards = cards.list_cards() a_card = all_cards[0] # WHEN we update() the card with new info cards.update_card(a_card.id, Card(owner="okken", done=True)) # THEN we can retrieve the card with get() and # and it has all of our changes updated_card = cards.get_card(a_card.id) expected = Card(summary=a_card.summary, owner="okken", done=True) assert updated_card == expected
def update(card_id, owner, priority, summary, done): """Modify a card in db with given id with new info.""" set_cards_db_path() cards.update_card(card_id, cards.Card(summary, owner, priority, done))