def test_video_block(notion): block = notion.root_page.children.add_new(VideoBlock) assert_block_is_okay(**locals(), type="video") source = "https://streamable.com/8ud2kh" assert_block_attributes(block, source=source, caption="caption")
def test_bookmark_block(notion): block = notion.root_page.children.add_new(BookmarkBlock) assert_block_is_okay(**locals(), type="bookmark") assert block.link == "" assert block.title == "" assert block.source == "" assert block.description == "" assert block.bookmark_icon is None assert block.bookmark_cover is None link = "github.com/arturtamborski/notion-py/" block.set_new_link(link) block.refresh() assert block.link == link assert block.title == "arturtamborski/notion-py" assert "This is a fork of the" in block.description assert "https://" in block.bookmark_icon assert "https://" in block.bookmark_cover block.set_source_url(link) block.refresh() assert block.source == link assert block.display_source == link
def test_page_block(notion): block = notion.root_page.children.add_new(PageBlock) assert_block_is_okay(**locals(), type="page") cover = "/images/page-cover/woodcuts_3.jpg" assert_block_attributes( block, title="numbered_list", cover=cover, color="blue", icon="✔️" )
def test_image_block(notion): block = notion.root_page.children.add_new(ImageBlock) assert_block_is_okay(**locals(), type="image") source = "https://raw.githubusercontent.com/jamalex/" source = source + "notion-py/master/ezgif-3-a935fdcb7415.gif" assert_block_attributes(block, source=source, caption="caption")
def test_block(notion): # create basic block from existing page block = Block(notion.client, notion.root_page.id) parent = notion.root_page.parent assert_block_is_okay(**locals(), type="page") assert len(block.children) == 0 assert len(block.parent.id) == 36 assert block.id == notion.root_page.id
def test_column_block(notion): block = notion.root_page.children.add_new(ColumnBlock) assert_block_is_okay(**locals(), type="column") assert block.column_ratio is None assert len(block.children) == 0 block.column_ratio = 1 / 2 block.refresh() assert block.column_ratio == 1 / 2
def test_embed_block(notion): block = notion.root_page.children.add_new(EmbedBlock) assert_block_is_okay(**locals(), type="embed") assert block.source == "" assert block.caption == "" caption = "block embed caption" block.caption = caption block.refresh() assert block.caption == caption
def test_column_list_block(notion): block = notion.root_page.children.add_new(ColumnListBlock) assert_block_is_okay(**locals(), type="column_list") assert len(block.children) == 0 block.children.add_new(ColumnBlock) block.children.add_new(ColumnBlock) block.evenly_space_columns() block.refresh() assert len(block.children) == 2 assert block.children[0].column_ratio == 1 / 2
def test_file_block(notion): block = notion.root_page.children.add_new(FileBlock) assert_block_is_okay(**locals(), type="file") assert block.title == "" assert block.source == "" assert block.file_id is None title = "requirements.txt" block.upload_file(title) block.title = title block.refresh() assert block.title == title assert "secure.notion-static.com" in block.source assert len(block.file_id) == 36
def test_code_block(notion): block = notion.root_page.children.add_new(CodeBlock) assert_block_is_okay(**locals(), type="code") assert_block_attributes(block, color="blue", language="Erlang", title="code")
def test_callout_block(notion): block = notion.root_page.children.add_new(CalloutBlock) assert_block_is_okay(**locals(), type="callout") assert_block_attributes(block, icon="✔️", color="blue", title="callout")
def test_bulleted_list_block(notion): block = notion.root_page.children.add_new(BulletedListBlock) assert_block_is_okay(**locals(), type="bulleted_list") assert_block_attributes(block, title="bulleted_list")
def test_codepen_block(notion): block = notion.root_page.children.add_new(CodepenBlock) assert_block_is_okay(**locals(), type="codepen") source = "https://codepen.io/MrWeb123/pen/QWyeQwp" assert_block_attributes(block, source=source, caption="caption")
def test_toggle_block(notion): block = notion.root_page.children.add_new(ToggleBlock) assert_block_is_okay(**locals(), type="toggle") assert_block_attributes(block, title="text", color="blue")
def test_drive_block(notion): block = notion.root_page.children.add_new(DriveBlock) assert_block_is_okay(**locals(), type="drive") source = "https://drive.google.com/file/" source = source + "d/15kESeWR9wCWT7GW9VvChakTGin68iZsw/view" assert_block_attributes(block, source=source, caption="drive")
def test_link_to_collection_block(notion): block = notion.root_page.children.add_new(LinkToCollectionBlock) assert_block_is_okay(**locals(), type="link_to_collection")
def test_equation_block(notion): block = notion.root_page.children.add_new(EquationBlock) assert_block_is_okay(**locals(), type="equation") assert_block_attributes(block, title="E=mc^{2}", color="blue")
def test_figma_block(notion): block = notion.root_page.children.add_new(FigmaBlock) assert_block_is_okay(**locals(), type="figma")
def test_gist_block(notion): block = notion.root_page.children.add_new(GistBlock) assert_block_is_okay(**locals(), type="gist") source = "https://gist.github.com/arturtamborski/" source = source + "539a335fcd71f88bb8c05f316f54ba31" assert_block_attributes(block, source=source, caption="caption")
def test_collection_row_block(notion): block = notion.root_page.children.add_new(CollectionRowBlock) assert_block_is_okay(**locals(), type="page")
def test_loom_block(notion): block = notion.root_page.children.add_new(LoomBlock) assert_block_is_okay(**locals(), type="loom")
def test_invision_block(notion): block = notion.root_page.children.add_new(InvisionBlock) assert_block_is_okay(**locals(), type="invision")
def test_divider_block(notion): block = notion.root_page.children.add_new(DividerBlock) assert_block_is_okay(**locals(), type="divider")
def test_link_to_page_block(notion): block = notion.root_page.children.add_new(LinkToPageBlock) assert_block_is_okay(**locals(), type="link_to_page") assert_block_attributes(block, title="")
def test_factory_block(notion): block = notion.root_page.children.add_new(FactoryBlock) assert_block_is_okay(**locals(), type="factory") assert_block_attributes(block, title="factory", color="blue")
def test_quote_block(notion): block = notion.root_page.children.add_new(QuoteBlock) assert_block_is_okay(**locals(), type="quote") assert_block_attributes(block, title="quote", color="blue")
def test_pdf_block(notion): block = notion.root_page.children.add_new(PdfBlock) assert_block_is_okay(**locals(), type="pdf")
def test_sub_sub_header_block(notion): block = notion.root_page.children.add_new(SubSubHeaderBlock) assert_block_is_okay(**locals(), type="sub_sub_header") assert_block_attributes(block, title="subsubheader", color="blue")
def test_breadcrumb_block(notion): block = notion.root_page.children.add_new(BreadcrumbBlock) assert_block_is_okay(**locals(), type="breadcrumb")
def test_to_do_block(notion): block = notion.root_page.children.add_new(ToDoBlock) assert_block_is_okay(**locals(), type="to_do") assert_block_attributes(block, title="text", color="blue", checked=True)