specter-desktop/tests/test_util_reflection.py
kdmukai 7b27c79907
Feature: Service integration - Swan (#1517)
* fix create_order issue
* fix url and better error-handling
* basic balances tab
* activating services
* Service management
* Improve settings page and default to it if token unset
* Fix history tab
* Fix trade error handling
* Add withdraw
* calling specter-cloud for creating vaultoro orders
* Improve trade screen and fixes
* sidebar fix
* black
* refactor Service integration
* refactor to have Service Classes like manifests
* maturity
* dynamic initialisation of service-classes and blueprints
* fix sidebar_services
* migrated templates and static into vaultoro folder
* refactor config to manifest
* some minor things
* swan initial
* rename and fix test
* adding ServiceApiKeyStorageUserAware
* fix
* store the access token
* directory indirection to shield templates from each others blueprint
* first attempts with automatic withdrawals
* proper tab highlighting
* Update service_apikey_storage.py
* Update oauth2_success.jinja
* Awaiting refresh_token support
* Service logo display on Addresses
* Associate addr with a Service
* address-data component reorg
Separates the presentation html from the data as much as possible.
* Services data/icon added to tx History
* Now hitting the updated Swan endpoint to save deposit addrs
* Simplified injecting Services data into JS
* Reducing js calls back to server in tx-data; templatizing utxo in/outs
* renaming "reserving" to "associating" an Address with a Service.
* rename `manifest.py` files to `service.py`.
* rename "api_data" to "service_data" to make the storage a bit more generalized. `ServiceApiKeyStorage` is now `ServiceEncryptedStorage` to match.
* Beginning of factoring out Swan api to its own `api.py` file; need to rectify with `swan_client.py`.
* Removed tx-table/row/data changes and address-table/row/data
Kept only the bare minimum changes required to display the Services icon, plus optimizations.
* deleted no longer used CustomElement
* Adding services docs to mkdocs
* Configuration for Services
* more clever configuration
* fix test
* deleted swan_client
* Changing the address abbreviation format to 7...7 and little big fix for not vertically aligned addresses in Firefox.
* Better state management if Auth method changes
* Cleanup, better user messaging; pulling Service methods out of controller and User
* Redirect to services endpoint after setting up authentication.
* PR cleanup, bug fixes, test suite updates
* Fixed test case problem
* First fix for delete API key button.
* Service hooks; Option to fully remove Swan Integration; Logout clears plaintext_user_secret
* Restoring bugfix from @moneymanolis
* cleanup and black
* Make service-decovery in AppImage work
* import hashlib, maybe fix cypress
* Update service_encrypted_storage.py
* further bugfix on update
* TODO: remove debugging in client.py before first release
* fix controller-test
* fix singleton testing issues

Co-authored-by: Kim Neunert <k9ert@gmx.de>
Co-authored-by: benk10 <ben.kaufman10@gmail.com>
Co-authored-by: Kim Neunert <kneunert@gmail.com>
Co-authored-by: moneymanolis <moneymanolis@protonmail.com>
2022-01-13 11:47:28 +01:00

37 lines
1.3 KiB
Python

import logging
from pathlib import Path
from cryptoadvance.specter.util.reflection import (
get_subclasses_for_class,
_get_module_from_class,
get_package_dir_for_subclasses_of,
)
from cryptoadvance.specter.util.specter_migrator import SpecterMigration
from cryptoadvance.specter.util.migrations.migration_0000 import SpecterMigration_0000
from cryptoadvance.specter.services.service_manager import Service
from cryptoadvance.specter.services.swan.service import SwanService
from cryptoadvance.specter.services.bitcoinreserve.service import BitcoinReserveService
def test_get_module_from_class():
assert (
_get_module_from_class(SpecterMigration).__name__
== "cryptoadvance.specter.util.specter_migrator"
)
def test_get_package_dir_for_subclasses_of():
assert get_package_dir_for_subclasses_of(SpecterMigration).endswith(
"cryptoadvance/specter/util/migrations"
)
assert get_package_dir_for_subclasses_of(Service).endswith(
"cryptoadvance/specter/services"
)
def test_get_subclasses_in_packagedir(caplog):
caplog.set_level(logging.INFO)
classlist = get_subclasses_for_class(SpecterMigration)
assert SpecterMigration_0000 in classlist
classlist = get_subclasses_for_class(Service)
assert SwanService in classlist
assert BitcoinReserveService in classlist