Esempio n. 1
0
def test_block_delete_with_text_block(notion_token):
    notion_api = NotionApi(token=notion_token)
    test_page = get_test_page()

    block = test_page.children.add_new(TextBlock, title="test block delete")
    parent_block = block.parent

    notion_api.block_delete(block.id)
    parent_block.refresh()

    assert block not in parent_block.children
Esempio n. 2
0
def test_block_delete_with_collection_block(notion_token):
    notion_api = NotionApi(token=notion_token)

    collection_view = create_collection_view()
    block = collection_view.collection.add_row(name="test row",
                                               value=10,
                                               enabled=True)

    notion_api.block_delete(block.id)

    assert block not in collection_view.collection.get_rows()
Esempio n. 3
0
def block_delete(notion_token, block_id):
    try:
        notion_api = NotionApi(notion_token)

        block = notion_api.block_delete(block_id)

        return jsonify(block), 200
    except Exception as error:
        return jsonify(error=str(error)), 500