Skip to content

Commit 2d9ba7e

Browse files
committed
fix: tests
1 parent 0c98f47 commit 2d9ba7e

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

tests/arduino/app_bricks/web_ui/test_web_ui_integration.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ def webui_server():
1818
f.write("<html><body>Hello</body></html>")
1919

2020
ui = WebUI(port=0, assets_dir_path=tmp_assets)
21+
def get_hello():
22+
return {"msg": "hello"}
23+
ui.expose_api("GET", "/api/hello", get_hello)
24+
def post_echo(data: dict):
25+
return {"echo": data.get("value")}
26+
ui.expose_api("POST", "/api/echo", post_echo)
2127
ui.start()
2228

2329
thread = threading.Thread(target=ui.execute, daemon=True)
@@ -38,16 +44,6 @@ def test_http_index(webui_server):
3844

3945

4046
def test_expose_api_rest(webui_server):
41-
def get_hello():
42-
return {"msg": "hello"}
43-
44-
webui_server.expose_api("GET", "/api/hello", get_hello)
45-
46-
def post_echo(data: dict):
47-
return {"echo": data.get("value")}
48-
49-
webui_server.expose_api("POST", "/api/echo", post_echo)
50-
5147
resp = requests.get(f"{webui_server.url}/api/hello")
5248
assert resp.status_code == 200
5349
assert resp.json() == {"msg": "hello"}

0 commit comments

Comments
 (0)