mirror of
https://github.com/rommapp/romm.git
synced 2026-12-05 23:44:11 +01:00
Changes and comments from self review
This commit is contained in:
@@ -14,6 +14,7 @@ from logger.logger import log
|
||||
|
||||
|
||||
class ConfigLoader:
|
||||
# Tests require custom config path
|
||||
def __init__(self, config_path: str = ROMM_USER_CONFIG_PATH):
|
||||
try:
|
||||
with open(config_path) as config_file:
|
||||
|
||||
21
backend/config/tests/fixtures/config.yml
vendored
21
backend/config/tests/fixtures/config.yml
vendored
@@ -1,38 +1,25 @@
|
||||
# Example config file used only for testing
|
||||
# Refer to examples/config.example.yml for a more detailed config file
|
||||
|
||||
exclude:
|
||||
# Exclude platforms to be scanned
|
||||
platforms:
|
||||
- 'romm'
|
||||
|
||||
# Exclude roms or parts of roms to be scanned
|
||||
roms:
|
||||
## Single file games section
|
||||
single_file:
|
||||
# Exclude matched file names to be sanned
|
||||
names:
|
||||
- 'info.txt'
|
||||
# Exclude all files with certain extensions to be scanned
|
||||
extensions:
|
||||
- 'xml'
|
||||
|
||||
## Multi files games section
|
||||
multi_file:
|
||||
# Exclude matched 'folder' (RomM identifies folders as multi file games) names to be scanned
|
||||
names:
|
||||
- 'my_multi_file_game'
|
||||
- 'DLC'
|
||||
parts:
|
||||
# Exclude matched file names to be sanned from multi file roms
|
||||
# Keep in mind that RomM doesn't scan folders inside multi files games,
|
||||
# so there is no need to exclude folders from inside of multi files games.
|
||||
names:
|
||||
- 'data.xml'
|
||||
# Exclude all files with certain extensions to be scanned from multi file roms
|
||||
extensions:
|
||||
- 'txt'
|
||||
|
||||
# Asociate different platform names to your current file system platform names
|
||||
system:
|
||||
platforms:
|
||||
# [your custom platform folder name]: [RomM platform name]
|
||||
gc: 'ngc' # In this example if you have a 'gc' folder, RomM will treat it like the 'ngc' folder
|
||||
psx: 'ps' # In this example if you have a 'psx' folder, RomM will treat it like the 'ps' folder
|
||||
gc: 'ngc'
|
||||
|
||||
@@ -15,7 +15,7 @@ def test_config_loader():
|
||||
assert loader.config["EXCLUDED_MULTI_FILES"] == ["my_multi_file_game", "DLC"]
|
||||
assert loader.config["EXCLUDED_MULTI_PARTS_EXT"] == ["txt"]
|
||||
assert loader.config["EXCLUDED_MULTI_PARTS_FILES"] == ["data.xml"]
|
||||
assert loader.config["PLATFORMS_BINDING"] == {"gc": "ngc", "psx": "ps"}
|
||||
assert loader.config["PLATFORMS_BINDING"] == {"gc": "ngc"}
|
||||
|
||||
|
||||
def test_empty_config_loader():
|
||||
|
||||
@@ -272,7 +272,7 @@ class TwitchAuth:
|
||||
|
||||
def get_oauth_token(self) -> str:
|
||||
if not self._is_token_valid():
|
||||
log.warning("Twitch token invalid: fetching a new one...")
|
||||
log.warning("Twitch token invalid: fetching a new one…")
|
||||
self._update_twitch_token()
|
||||
|
||||
return self.token
|
||||
|
||||
@@ -11,7 +11,8 @@ engine = create_engine(ConfigLoader.get_db_engine(), pool_pre_ping=True)
|
||||
session = sessionmaker(bind=engine, expire_on_commit=False)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
# Use this fixture to run alembic migrations before running tests
|
||||
@pytest.fixture(scope="session")
|
||||
def setup_database():
|
||||
alembic.config.main(argv=["upgrade", "head"])
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
# from logger.logger import log
|
||||
from logger.logger import log
|
||||
|
||||
# def test_logger(caplog):
|
||||
# log.debug("Testing debug message")
|
||||
# assert "debug message" in caplog.text
|
||||
def test_logger(caplog):
|
||||
log.debug("Testing debug message")
|
||||
assert "debug message" in caplog.text
|
||||
|
||||
# log.info("Testing info message")
|
||||
# assert "info message" in caplog.text
|
||||
log.info("Testing info message")
|
||||
assert "info message" in caplog.text
|
||||
|
||||
# log.warning("Testing warning message")
|
||||
# assert "warning message" in caplog.text
|
||||
log.warning("Testing warning message")
|
||||
assert "warning message" in caplog.text
|
||||
|
||||
# log.error("Testing error message")
|
||||
# assert "error message" in caplog.text
|
||||
log.error("Testing error message")
|
||||
assert "error message" in caplog.text
|
||||
|
||||
# log.critical("Testing critical message")
|
||||
# assert "critical message" in caplog.text
|
||||
log.critical("Testing critical message")
|
||||
assert "critical message" in caplog.text
|
||||
|
||||
Reference in New Issue
Block a user