File size: 452 Bytes
fd0c71a
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from fastapi.testclient import TestClient

from app.env.fastapi_app import app


def test_remote_env_roundtrip() -> None:
    client = TestClient(app)
    reset = client.post("/env/reset", json={})
    assert reset.status_code == 200
    legal = client.get("/env/legal_actions")
    action = legal.json()[0]
    stepped = client.post("/env/step", json=action)
    assert stepped.status_code == 200
    assert 0.001 <= stepped.json()["reward"] <= 0.999