Skip to content

Commit 013ce64

Browse files
committed
feat: move into example dir / poetry package and add test
1 parent 0b47035 commit 013ce64

31 files changed

+20
-3
lines changed

__init__.py renamed to example/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from fastapi import APIRouter
44
from lnbits.db import Database
5-
from lnbits.tasks import create_permanent_unique_task
65
from loguru import logger
76

87
from .tasks import wait_for_paid_invoices
@@ -34,7 +33,8 @@ def example_stop():
3433

3534

3635
def example_start():
37-
# ignore will be removed in lnbits `0.12.6`
36+
# ignore will be removed in lnbits `0.12.7`
3837
# https://github.com/lnbits/lnbits/pull/2417
38+
from lnbits.tasks import create_permanent_unique_task
3939
task = create_permanent_unique_task("ext_testing", wait_for_paid_invoices) # type: ignore
4040
scheduled_tasks.append(task)
File renamed without changes.

crud.py renamed to example/crud.py

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.poetry]
2-
name = "lnbits-example"
2+
name = "example"
33
version = "0.0.0"
44
description = "LNbits, free and open-source Lightning wallet and accounts system."
55
authors = ["Alan Bits <alan@lnbits.com>"]

tests/test_init.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pytest
2+
from fastapi import APIRouter
3+
4+
from example import example_ext, example_start, example_stop
5+
6+
7+
# just import router and add it to a test router
8+
@pytest.mark.asyncio
9+
async def test_router():
10+
router = APIRouter()
11+
router.include_router(example_ext)
12+
assert 1 == 1
13+
14+
@pytest.mark.asyncio
15+
async def test_start_and_stop():
16+
example_start()
17+
example_stop()

0 commit comments

Comments
 (0)