Skip to content

Commit 867c046

Browse files
committed
fix(tests): fix tests
replace default_dev config if it was manually changed add now required property in jsg test
1 parent 826096d commit 867c046

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

tests/test_install.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import os
2+
from pathlib import Path
23
from esgvoc.core import service
34
import esgvoc.api as ev
45

56

67
def _ensure_default_dev_config_exists():
7-
"""Ensure the 'default_dev' config exists for development testing."""
8+
"""Ensure the 'default_dev' config exists for development testing and matches expected values."""
89
default_dev_config = {
910
"projects": [
1011
{
@@ -33,10 +34,16 @@ def _ensure_default_dev_config_exists():
3334
},
3435
}
3536

36-
# Check if default_dev config exists
3737
existing_configs = service.config_manager.list_configs()
3838
if "default_dev" not in existing_configs:
3939
service.config_manager.add_config("default_dev", default_dev_config)
40+
else:
41+
# Verify existing config matches expected values by reading the raw TOML file
42+
config_path = existing_configs["default_dev"]
43+
existing_config = service.config_manager._load_toml(Path(config_path))
44+
if existing_config != default_dev_config:
45+
service.config_manager.remove_config("default_dev")
46+
service.config_manager.add_config("default_dev", default_dev_config)
4047

4148

4249
def _ensure_all_dev_config_exists():
@@ -137,6 +144,7 @@ def test_install():
137144
# Verify the expected projects are present
138145
projects = ev.get_all_projects()
139146
# default_dev and default have 2 projects, "all" has 7
147+
print(projects)
140148
if test_config in ["default_dev", "default"]:
141149
assert len(projects) == 2
142150
assert "cmip6" in projects
@@ -156,4 +164,5 @@ def test_install():
156164
# Switch back to the selected test config for the rest of the tests
157165
# (The session fixture will restore the original config at the very end)
158166
service.config_manager.switch_config(test_config)
159-
current_state = service.get_state()
167+
current_state = service.get_state()
168+

tests/test_js_generator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def _get_extension_urls(project_id: str) -> list[str]:
182182
"created": "2025-01-24T14:29:23.741213Z",
183183
"file:checksum": "90e402107a7f2588a85362b9beea2a12d4514d45",
184184
"file:size": 23553,
185+
"file:local_path": "/badc/cmip6/data/CMIP6/ScenarioMIP/THU/CIESM/ssp585/r1i1p1f1/Amon/rsus/gr/v20200806/rsus_Amon_CIESM_ssp585_r1i1p1f1_gr_402901-411412.nc",
185186
"node": "dap.ceda.ac.uk",
186187
"protocol": "s3",
187188
"updated": "2025-01-24T14:29:23.741213Z",

0 commit comments

Comments
 (0)