Skip to content

Commit 1d4d38d

Browse files
test: add jsg tests
1 parent b4a8805 commit 1d4d38d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/test_js_generator.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from typing import Generator
2+
3+
import pytest
4+
5+
from esgvoc_backend import jsg
6+
from tests.utils import _test_get, client_factory
7+
8+
router = jsg.router
9+
10+
JSG_PROJECT_IDS = ["cmip6"]
11+
12+
13+
@pytest.fixture(scope='module')
14+
def client(request):
15+
return client_factory(request, router)
16+
17+
18+
def _provide_get_jsg_project_ids() -> Generator:
19+
for param in JSG_PROJECT_IDS:
20+
yield param
21+
22+
@pytest.fixture(params=_provide_get_jsg_project_ids())
23+
def jsg_project_id(request) -> str:
24+
return request.param
25+
26+
27+
def test_js_generation(client, jsg_project_id) -> None:
28+
url = f'/{jsg_project_id}'
29+
json_result = _test_get(client=client, url=url, params=None, select=False, id=None)
30+
assert json_result

0 commit comments

Comments
 (0)