File tree 4 files changed +36
-0
lines changed
4 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ [pytest]
2
+ pythonpath = .
3
+ testpaths = tests
4
+ addopts = -v -ra -q
Original file line number Diff line number Diff line change
1
+ httpx
2
+ pytest
Original file line number Diff line number Diff line change
1
+ from fastapi .testclient import TestClient
2
+ from api .server import app
3
+
4
+ client = TestClient (app )
5
+
6
+
7
+ def test_read_root ():
8
+ response = client .get ("/" )
9
+ assert response .status_code == 200
10
+ assert response .json () == {
11
+ "message" : "Hello from FastAPI"
12
+ } # Updated expected message
13
+
14
+
15
+ def test_demo_post ():
16
+ response = client .post ("/demo_post" , json = {"data" : "test" })
17
+ assert response .status_code == 200
18
+ assert response .json () == {"message" : "Received data: test" }
Original file line number Diff line number Diff line change
1
+ import streamlit as st
2
+ from streamlit .testing .v1 import AppTest
3
+
4
+
5
+ def test_streamlit_app ():
6
+ # Create an instance of AppTest from file
7
+ at = AppTest .from_file ("app/streamlit_app.py" )
8
+
9
+ # Run the app
10
+ at .run ()
11
+
12
+ print ("test_streamlit_app completed successfully" )
You can’t perform that action at this time.
0 commit comments