7be680cbe5
* docs: initial migration to docusaurus * website: add custom font, update blurbs and icons * website: update splash * root: update links to docs * flows: use .pbflow extension so docusaurus doesn't mangle the files * e2e: workaround prospector * Squashed commit of the following: commit1248585dca
Author: Jens Langhammer <jens.langhammer@beryju.org> Date: Sun Nov 15 20:46:53 2020 +0100 e2e: attempt to fix prospector error again commit1319c480c4
Author: Jens Langhammer <jens.langhammer@beryju.org> Date: Sun Nov 15 20:41:35 2020 +0100 ci: install previous python version for upgrade testing * web: update accent colours and format * website: format markdown files * website: fix colours for text * website: switch to temporary accent colour to improve readability * flows: fix path for TestTransferDocs * flows: fix formatting of tests
30 lines
896 B
Python
30 lines
896 B
Python
"""test example flows in docs"""
|
|
from glob import glob
|
|
from pathlib import Path
|
|
from typing import Callable
|
|
|
|
from django.test import TransactionTestCase
|
|
|
|
from passbook.flows.transfer.importer import FlowImporter
|
|
|
|
|
|
class TestTransferDocs(TransactionTestCase):
|
|
"""Empty class, test methods are added dynamically"""
|
|
|
|
|
|
def pbflow_tester(file_name: str) -> Callable:
|
|
"""This is used instead of subTest for better visibility"""
|
|
|
|
def tester(self: TestTransferDocs):
|
|
with open(file_name, "r") as flow_json:
|
|
importer = FlowImporter(flow_json.read())
|
|
self.assertTrue(importer.validate())
|
|
self.assertTrue(importer.apply())
|
|
|
|
return tester
|
|
|
|
|
|
for flow_file in glob("website/static/flows/*.pbflow"):
|
|
method_name = Path(flow_file).stem.replace("-", "_").replace(".", "_")
|
|
setattr(TestTransferDocs, f"test_flow_{method_name}", pbflow_tester(flow_file))
|