Test static app factory

This commit is contained in:
Igor Radovanovic
2023-07-26 12:05:01 +02:00
parent ff4a469047
commit b7cf6b556e
2 changed files with 50 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
"""App factory."""
# pylint: disable=W0231:super-init-not-called
from openbb_core.app.command_runner import CommandRunnerSession
@@ -8,6 +9,7 @@ from openbb_core.app.static.coverage import Coverage
def create_app():
"""Create the app."""
try:
# pylint: disable=import-outside-toplevel
from openbb_core.app.static.package.__commands__ import Commands

View File

@@ -0,0 +1,48 @@
"""Test static app factory."""
# pylint: disable=redefined-outer-name
import pytest
from openbb_core.app.model.system_settings import SystemSettings
from openbb_core.app.model.user_settings import UserSettings
from openbb_core.app.static.account import Account
from openbb_core.app.static.app_factory import create_app
from openbb_core.app.static.coverage import Coverage
@pytest.fixture(scope="module")
def app_factory():
"""Return app factory."""
return create_app()
def test_app_factory_init(app_factory):
"""Test app factory init."""
assert app_factory
def test_app_system_settings(app_factory):
"""Test app system settings."""
system_settings = app_factory.system
assert system_settings
assert isinstance(system_settings, SystemSettings)
def test_app_user_settings(app_factory):
"""Test app user settings."""
user_settings = app_factory.settings
assert user_settings
assert isinstance(user_settings, UserSettings)
def test_app_account(app_factory):
"""Test app account."""
account = app_factory.account
assert account
assert isinstance(account, Account)
def test_app_coverage(app_factory):
"""Test app coverage."""
coverage = app_factory.coverage
assert coverage
assert isinstance(coverage, Coverage)