Exemplo n.º 1
0
def collection_view(notion_token, collection_id, view_id):
    try:
        notion_api = NotionApi(notion_token)

        content = notion_api.collection_view_content(collection_id, view_id)

        return jsonify(content), 200
    except Exception as error:
        return jsonify(error=str(error)), 500
Exemplo n.º 2
0
def test_collection_view_content(notion_token):
    notion_api = NotionApi(token=notion_token)

    collection_view = create_collection_view()
    collection_id = collection_view.parent.id.replace("-", "")
    view_id = collection_view.id.replace("-", "")

    collection_view.collection.add_row(name="test row")
    collection_view_content = notion_api.collection_view_content(
        collection_id, view_id)

    assert collection_view_content[0]["name"] == "test row"
Exemplo n.º 3
0
def test_collection_view_append(notion_token):
    notion_api = NotionApi(token=notion_token)

    collection_view = create_collection_view()
    collection_id = collection_view.parent.id.replace("-", "")
    view_id = collection_view.id.replace("-", "")

    notion_api.collection_append(collection_id, view_id, {
        "enabled": True,
        "value": 10,
        "name": "test row"
    })
    collection_view_content = notion_api.collection_view_content(
        collection_id, view_id)

    assert collection_view_content[0]["name"] == "test row"
    assert collection_view_content[0]["enabled"] is True
    assert collection_view_content[0]["value"] == 10