* feat: remove js2py dependency * style: apply code stype isort * feat: remove interpreter * style: fix type hints * test: fix image url fixture * feat: add refresh func and fix some problem * style: fix type hints * style: common js is native we refresh gg js * feat: remove common js request func * chore(deps): remove bs4
40 lines
1,004 B
Python
40 lines
1,004 B
Python
from heliotrope.argparser import parse_args
|
|
from heliotrope.config import HeliotropeConfig
|
|
|
|
|
|
def test_parse_args():
|
|
config = HeliotropeConfig()
|
|
args = parse_args(
|
|
[
|
|
"--host",
|
|
"127.0.0.1",
|
|
"--port",
|
|
"8000",
|
|
"--workers",
|
|
"1",
|
|
]
|
|
)
|
|
config.update_with_args(args)
|
|
assert args.host == "127.0.0.1"
|
|
assert args.port == 8000
|
|
assert args.workers == 1
|
|
|
|
|
|
def test_parse_args_with_config():
|
|
config = HeliotropeConfig()
|
|
args = parse_args(
|
|
[
|
|
"--config",
|
|
"tests/config.json",
|
|
]
|
|
)
|
|
config.update_with_args(args)
|
|
|
|
assert (
|
|
config.GALLERYINFO_DB_URL
|
|
== "postgresql+asyncpg://postgres:test@localhost/test_heliotrope"
|
|
)
|
|
assert config.INFO_DB_URL == "mongodb://root:test@127.0.0.1"
|
|
assert config.INDEX_FILE == ["index-english.nozomi"]
|
|
assert config.MIRRORING_DELAY == 3600
|
|
assert config.REFRESH_GG_JS_DELAY == 86400
|