2021-11-17 16:53:32 +00:00
|
|
|
.PHONY: test
|
|
|
|
|
2020-09-15 18:54:05 +00:00
|
|
|
all: format check requirements.txt
|
2020-09-03 01:06:53 +00:00
|
|
|
|
2022-07-16 12:10:43 +00:00
|
|
|
format: prettier isort black
|
2020-09-03 01:06:53 +00:00
|
|
|
|
2022-08-17 13:42:01 +00:00
|
|
|
check: mypy checkprettier checkisort checkblack
|
2020-08-31 02:19:43 +00:00
|
|
|
|
2020-08-29 17:10:26 +00:00
|
|
|
prettier: $(shell find lnbits -name "*.js" -name ".html")
|
2022-08-09 09:00:09 +00:00
|
|
|
./node_modules/.bin/prettier --write lnbits/static/js/*.js lnbits/core/static/js/*.js lnbits/extensions/*/templates/*/*.html ./lnbits/core/templates/core/*.html lnbits/templates/*.html lnbits/extensions/*/static/js/*.js lnbits/extensions/*/static/components/*/*.js lnbits/extensions/*/static/components/*/*.html
|
2020-08-29 17:10:26 +00:00
|
|
|
|
2022-08-03 12:10:32 +00:00
|
|
|
black:
|
|
|
|
poetry run black .
|
2020-09-03 01:06:53 +00:00
|
|
|
|
2022-08-03 12:10:32 +00:00
|
|
|
mypy:
|
|
|
|
poetry run mypy
|
2020-08-31 02:19:43 +00:00
|
|
|
|
2022-08-03 12:10:32 +00:00
|
|
|
isort:
|
|
|
|
poetry run isort .
|
2022-07-16 12:10:43 +00:00
|
|
|
|
2020-09-03 01:06:53 +00:00
|
|
|
checkprettier: $(shell find lnbits -name "*.js" -name ".html")
|
2022-08-09 09:00:09 +00:00
|
|
|
./node_modules/.bin/prettier --check lnbits/static/js/*.js lnbits/core/static/js/*.js lnbits/extensions/*/templates/*/*.html ./lnbits/core/templates/core/*.html lnbits/templates/*.html lnbits/extensions/*/static/js/*.js lnbits/extensions/*/static/components/*/*.js lnbits/extensions/*/static/components/*/*.html
|
2020-09-03 01:06:53 +00:00
|
|
|
|
2022-08-03 12:10:32 +00:00
|
|
|
checkblack:
|
|
|
|
poetry run black --check .
|
2020-09-14 00:31:05 +00:00
|
|
|
|
2022-08-03 12:10:32 +00:00
|
|
|
checkisort:
|
|
|
|
poetry run isort --check-only .
|
2021-11-17 16:53:32 +00:00
|
|
|
|
|
|
|
test:
|
2022-09-23 08:35:18 +00:00
|
|
|
BOLTZ_NETWORK="regtest" \
|
|
|
|
BOLTZ_URL="http://127.0.0.1:9001" \
|
|
|
|
BOLTZ_MEMPOOL_SPACE_URL="http://127.0.0.1:8080" \
|
|
|
|
BOLTZ_MEMPOOL_SPACE_URL_WS="ws://127.0.0.1:8080" \
|
2022-07-16 12:10:43 +00:00
|
|
|
LNBITS_BACKEND_WALLET_CLASS="FakeWallet" \
|
2022-06-26 22:11:46 +00:00
|
|
|
FAKE_WALLET_SECRET="ToTheMoon1" \
|
2021-11-17 16:53:32 +00:00
|
|
|
LNBITS_DATA_FOLDER="./tests/data" \
|
|
|
|
PYTHONUNBUFFERED=1 \
|
2022-08-17 13:57:56 +00:00
|
|
|
DEBUG=true \
|
2022-08-03 12:10:32 +00:00
|
|
|
poetry run pytest
|
2022-07-16 12:10:43 +00:00
|
|
|
|
|
|
|
test-real-wallet:
|
Boltz.exchange Extension (#922)
* initial commit and still draft, ready for review
* forgot to uncomment this line
* fee estimation and blockheight
* resolve conversation with michael, to use mempool websockets instead of boltz status event
* Update lnbits/extensions/boltz/boltz.py
Co-authored-by: michael1011 <me@michael1011.at>
* add status to swaps, add sorting and data into listing
* add swap status checks, change urls to docker test setup, dynamic minimum and maximum limits
* fix docker hosts for development
* add api endpoints to _api_docs
* add wallet name and id, to list and status information
* fix status_update for reverse_swaps
* chore: format with black
* more blackformatting and refactoring create_swap()
* fix variable bug
* check if swap is already refunded
* use create_task instead of ensure_future
* add mempool and boltz urls depending on DEBUG .env
* raise exception in mempool fails
* fix onchain txs, sending funds to wrong address and add a refund address for normal swaps beforehand
* add status to swaps, add sorting and data into listing
* add swap status checks, change urls to docker test setup, dynamic minimum and maximum limits
* add wallet name and id, to list and status information
* fix status_update for reverse_swaps
* chore: format with black
* use create_task instead of ensure_future
* add mempool and boltz urls depending on DEBUG .env
* fix onchain txs, sending funds to wrong address and add a refund address for normal swaps beforehand
* black formatting
* add some logging with loguru, and remove function duplication
* cleanup readme
* updates/suggestions from calle
Co-authored-by: calle <93376500+callebtc@users.noreply.github.com>
* remove unused comments
* Update API Endpoints
Co-authored-by: calle <93376500+callebtc@users.noreply.github.com>
* un-factor get_boltz_pairs
* added a explaination for the onchain tx
* remove unused template file
* rename api endpoints
* fix isort and prettier
* more verbose logging!!
* add boltz to mock_data.zip
* new mockdata
* remove comment
* better readme
* fix mempool urls
* change /refund /check /status to post requests
* first step in tests2
* add first tests
* change refund,check,status to post requests
* next try on tests
* overall code improvements
* just testing tests
* throw http exceptions in views_api
* require admincheck for refund,check,status and added fastapi documentation for those
* added more tests
* black
* many code improvements
* adding tests
* temp fix test
* fix race condition when pay_invoice fails
* test are working
* add boltz env variables
* add startup check, bugfixes, improvements
* improve on status checking
* remove check_invoice_status
* more fixes and tests
* testing testing testing
* make tests run again inside regtest
* fix bad error :O
* fix postgres boolean bug and add swap test
* Update README.md
Update README.md
Update README.md
Update README.md
* some mypy
* blacked
* the missing commit?
* fix api_docs readme link
* better refunding error catching
fix
* check swaps now also shows pending reverse swap, ui improvements, tooltips
* add backend check for boltz limits
fixup
* many improvements, startup check for swaps working, reverse needs more testing
* little last fixes
* remove unused logic
* fastapi documentation
fixup
* formatting and remove unused tests
* fix test
* fix swapstatus model
* Update lnbits/extensions/boltz/tasks.py
Co-authored-by: calle <93376500+callebtc@users.noreply.github.com>
* Update lnbits/extensions/boltz/views_api.py
Co-authored-by: calle <93376500+callebtc@users.noreply.github.com>
* balance check msg, format
* fix mypy data override
* fix swapstatus, remove can refund column
* Update lnbits/extensions/boltz/README.md
Co-authored-by: michael1011 <me@michael1011.at>
* empty lines
* fix error message when swap is not found
* remove preimage_hash from database
* fix api_docs html
fix api_docs html
* catch boltz network exceptions better
* formatting
* check for timeout on swap at get request
Co-authored-by: michael1011 <me@michael1011.at>
Co-authored-by: fusion44 <some.fusion@gmail.com>
Co-authored-by: calle <93376500+callebtc@users.noreply.github.com>
2022-08-30 10:51:17 +00:00
|
|
|
BOLTZ_NETWORK="regtest" \
|
|
|
|
BOLTZ_URL="http://127.0.0.1:9001" \
|
|
|
|
BOLTZ_MEMPOOL_SPACE_URL="http://127.0.0.1:8080" \
|
|
|
|
BOLTZ_MEMPOOL_SPACE_URL_WS="ws://127.0.0.1:8080" \
|
2022-07-16 12:10:43 +00:00
|
|
|
LNBITS_DATA_FOLDER="./tests/data" \
|
|
|
|
PYTHONUNBUFFERED=1 \
|
2022-08-17 13:57:56 +00:00
|
|
|
DEBUG=true \
|
2022-08-03 12:10:32 +00:00
|
|
|
poetry run pytest
|
2022-06-26 22:11:46 +00:00
|
|
|
|
2022-08-03 12:10:32 +00:00
|
|
|
test-venv:
|
2022-09-23 08:35:18 +00:00
|
|
|
BOLTZ_NETWORK="regtest" \
|
|
|
|
BOLTZ_URL="http://127.0.0.1:9001" \
|
|
|
|
BOLTZ_MEMPOOL_SPACE_URL="http://127.0.0.1:8080" \
|
|
|
|
BOLTZ_MEMPOOL_SPACE_URL_WS="ws://127.0.0.1:8080" \
|
2022-07-16 12:10:43 +00:00
|
|
|
LNBITS_BACKEND_WALLET_CLASS="FakeWallet" \
|
2022-07-12 23:15:48 +00:00
|
|
|
FAKE_WALLET_SECRET="ToTheMoon1" \
|
|
|
|
LNBITS_DATA_FOLDER="./tests/data" \
|
|
|
|
PYTHONUNBUFFERED=1 \
|
2022-08-17 13:57:56 +00:00
|
|
|
DEBUG=true \
|
2022-08-03 12:10:32 +00:00
|
|
|
./venv/bin/pytest --durations=1 -s --cov=lnbits --cov-report=xml tests
|
2022-07-12 23:15:48 +00:00
|
|
|
|
2022-08-17 13:42:01 +00:00
|
|
|
test-migration:
|
|
|
|
rm -rf ./migration-data
|
|
|
|
mkdir -p ./migration-data
|
|
|
|
unzip tests/data/mock_data.zip -d ./migration-data
|
|
|
|
HOST=0.0.0.0 \
|
|
|
|
PORT=5002 \
|
|
|
|
LNBITS_DATA_FOLDER="./migration-data" \
|
|
|
|
timeout 5s poetry run lnbits --host 0.0.0.0 --port 5002 || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
|
|
|
|
HOST=0.0.0.0 \
|
|
|
|
PORT=5002 \
|
|
|
|
LNBITS_DATABASE_URL="postgres://lnbits:lnbits@localhost:5432/migration" \
|
|
|
|
timeout 5s poetry run lnbits --host 0.0.0.0 --port 5002 || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
|
|
|
|
LNBITS_DATA_FOLDER="./migration-data" \
|
|
|
|
LNBITS_DATABASE_URL="postgres://lnbits:lnbits@localhost:5432/migration" \
|
|
|
|
poetry run python tools/conv.py
|
|
|
|
|
|
|
|
migration:
|
|
|
|
poetry run python tools/conv.py
|
|
|
|
|
2022-06-26 22:11:46 +00:00
|
|
|
bak:
|
|
|
|
# LNBITS_DATABASE_URL=postgres://postgres:postgres@0.0.0.0:5432/postgres
|