22 lines
526 B
Python
22 lines
526 B
Python
|
from fastapi.testclient import TestClient
|
||
|
|
||
|
from sms_handler.server import app
|
||
|
|
||
|
client = TestClient(app)
|
||
|
|
||
|
|
||
|
def test_handle_sms():
|
||
|
with TestClient(app) as client:
|
||
|
response = client.post(
|
||
|
"/handle-sms",
|
||
|
json={
|
||
|
"text": "Hello!",
|
||
|
"from": "12345678",
|
||
|
"sentStamp": "1234",
|
||
|
"receivedStamp": "1235",
|
||
|
"sim": "1",
|
||
|
},
|
||
|
)
|
||
|
assert response.status_code == 200
|
||
|
assert response.json() == "OK"
|