specter-desktop/tests/test_util_reflection_fs.py
Kim Neunert b73e398c36
Feature: CLI and a publishing model for extensions (#1566)
* introduction of url-prefixes and defaults

* starting a cli for extensions

* more verbose

* extension-test-data

* logger improvements

* bugfixes and testing

* adding  clasification

* rename spext -> specterext

* distinguish isolated_client and refactoring

* improved error-message

* better error_management

* fix tests

* ext gen completion

* fix endpoint issue

* added .gitignore  and txs

* formatting

* very basic callback-infra

* beauty

* fix tests, tidy up, follow-links

* proper mocking for extgen

* adding a test for plugins

* fix tests + docs

* error-handling for non existing extensions

* extensiongen config and making config work for new style

* avoid pollition

* ups

* kick

* kick

* proper renaming of spext

* fix tests

* ToDo remark

* fix test finally

* fix the fixing fixing test

* documentation

* revert mounting for all config see #1595

* fix tests

* fix cypress-test

* prevent pollution

* revert address-data to fix test

* added ID

* bugfix for test-cypress
2022-02-25 16:38:41 +01:00

62 lines
1.7 KiB
Python

import os
from pathlib import Path
from cryptoadvance.specter.util.reflection_fs import (
search_dirs_in_path,
detect_extension_style_in_cwd,
)
from typing import List
def test_search_dir_in_cwd():
plist: List[Path] = search_dirs_in_path(Path("./tests/xtestdata_testextensions"))
assert len(plist) == 2
assert isinstance(plist[0], Path)
assert (
Path(
"tests/xtestdata_testextensions/ext_root_fully_qualified_1/src/boatacccorp/specterext"
)
in plist
)
assert (
Path(
"tests/xtestdata_testextensions/ext_root_fully_qualified_2/src/boatacccorp/specterext"
)
in plist
)
plist = search_dirs_in_path(
Path("./tests/xtestdata_testextensions"), return_without_extid=False
)
assert len(plist) == 2
assert isinstance(plist[0], Path)
assert (
Path(
"tests/xtestdata_testextensions/ext_root_fully_qualified_1/src/boatacccorp/specterext/tretboot"
)
in plist
)
assert (
Path(
"tests/xtestdata_testextensions/ext_root_fully_qualified_2/src/boatacccorp/specterext/ruderboot"
)
in plist
)
def test_detect_extension_style_in_cwd():
assert (
detect_extension_style_in_cwd(
"tests/xtestdata_testextensions/ext_root_fully_qualified_1"
)
== "publish-ready"
) #
assert (
detect_extension_style_in_cwd(
"tests/xtestdata_testextensions/ext_root_fully_qualified_2"
)
== "publish-ready"
)
assert (
detect_extension_style_in_cwd("tests/xtestdata_testextensions/ext_root_adhoc_1")
== "adhoc"
)