示例#1
0
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))
示例#2
0
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'
示例#3
0
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
示例#4
0
文件: cli.py 项目: kpinjari/cards
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))