Add configurable UPC and RA setup flows
This commit is contained in:
@@ -52,3 +52,29 @@ def test_missing_required_settings_fail_before_browser_start():
|
||||
def test_legacy_config_remains_supported():
|
||||
config = {"product": {"me_instance": "55"}, "trading_token_idas": {"market_code": "NATIONAL", "product_code": "IDAS4"}}
|
||||
assert get_setup_configs("combined", config)[0]["token"] == config["trading_token_idas"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("selected", [[], ["DAILY"], ["WEEKLY"], ["MONTHLY"], ["DAILY", "WEEKLY", "MONTHLY"]])
|
||||
def test_upc_session_selection_and_shared_timing(selected):
|
||||
config = {
|
||||
"setup": {"session": {"start_offset_minutes": 7, "end_time": "20:30"}},
|
||||
"products": {"UPC": {
|
||||
"run_session": True,
|
||||
"run_token": False,
|
||||
"session_variants": {
|
||||
name: {"enabled": name in selected, "me_instance": instance}
|
||||
for name, instance in (("DAILY", "58"), ("WEEKLY", "59"), ("MONTHLY", "60"))
|
||||
},
|
||||
}},
|
||||
}
|
||||
original = deepcopy(config)
|
||||
sessions = get_setup_configs("session", config)
|
||||
assert [c["product_name"] for c in sessions] == [f"UPC_{name}" for name in selected]
|
||||
ids = {"DAILY": "58", "WEEKLY": "59", "MONTHLY": "60"}
|
||||
assert [c["product"]["me_instance"] for c in sessions] == [ids[name] for name in selected]
|
||||
assert all(c["setup"]["session"] == config["setup"]["session"] for c in sessions)
|
||||
assert get_setup_configs("combined", config) == []
|
||||
assert get_setup_configs("token", config) == []
|
||||
assert config == original
|
||||
config["products"]["UPC"]["enabled"] = False
|
||||
assert get_setup_configs("session", config) == []
|
||||
|
||||
Reference in New Issue
Block a user