from iroh import Iroh, NodeOptions
import pytest
import iroh
import asyncio
@pytest.mark.asyncio
async def test_author_api():
iroh.iroh_ffi.uniffi_set_event_loop(asyncio.get_running_loop())
options = NodeOptions()
options.enable_docs = True
node = await Iroh.memory_with_options(options)
assert len(await node.authors().list()) == 1
author_id = await node.authors().create()
authors = await node.authors().list()
assert len(authors) == 2
author = await node.authors().export(author_id)
assert author_id.equal(author.id())
await node.authors().delete(author_id)
authors = await node.authors().list()
assert len(authors) == 1
await node.authors().import_author(author)
authors = await node.authors().list()
assert len(authors) == 2