-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The get_info API returns run_statuses and end_statuses.
- Loading branch information
wei
committed
Aug 23, 2024
1 parent
89e8491
commit 8a547dd
Showing
7 changed files
with
346 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Tests webapi and things that depend on it | ||
|
||
import pytest | ||
import responses | ||
import tidy3d as td | ||
from tidy3d.web.api.webapi import ( | ||
get_system_config, | ||
) | ||
from tidy3d.web.core.environment import Env | ||
|
||
task_core_path = "tidy3d.web.core.task_core" | ||
api_path = "tidy3d.web.api.webapi" | ||
|
||
Env.dev.active() | ||
|
||
|
||
@pytest.fixture | ||
def set_api_key(monkeypatch): | ||
"""Set the api key.""" | ||
import tidy3d.web.core.http_util as http_module | ||
|
||
monkeypatch.setattr(http_module, "api_key", lambda: "apikey") | ||
monkeypatch.setattr(http_module, "get_version", lambda: td.version.__version__) | ||
|
||
|
||
@pytest.fixture | ||
def mock_get_system_config(monkeypatch, set_api_key): | ||
"""Mocks webapi.get_info.""" | ||
|
||
responses.add( | ||
responses.GET, | ||
f"{Env.current.web_api_endpoint}/tidy3d/system/py/config", | ||
json={ | ||
"data": { | ||
"runStatuses": [], | ||
"endStatuses": [], | ||
} | ||
}, | ||
status=200, | ||
) | ||
|
||
|
||
@responses.activate | ||
def test_system_config(mock_get_system_config): | ||
info = get_system_config() | ||
assert info is not None |
Oops, something went wrong.