-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a8bc9c8
commit db68162
Showing
4 changed files
with
20 additions
and
20 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 |
---|---|---|
@@ -1,45 +1,45 @@ | ||
from tests.fastapi.models import WindowAPI | ||
|
||
|
||
def test_create_window(api_client): | ||
async def test_create_window(api_client): | ||
payload = {"x": 10, "y": 20} | ||
resp = api_client.post("/v1/windows/", json=payload) | ||
resp = await api_client.post("/v1/windows/", json=payload) | ||
resp_json = resp.json() | ||
assert resp_json["x"] == 10 | ||
assert resp_json["y"] == 20 | ||
|
||
|
||
def test_create_house(api_client): | ||
async def test_create_house(api_client): | ||
payload = {"x": 10, "y": 20} | ||
resp = api_client.post("/v1/houses/", json=payload) | ||
resp = await api_client.post("/v1/houses/", json=payload) | ||
resp_json = resp.json() | ||
assert len(resp_json["windows"]) == 1 | ||
|
||
|
||
def test_create_house_with_window_link(api_client): | ||
async def test_create_house_with_window_link(api_client): | ||
payload = {"x": 10, "y": 20} | ||
resp = api_client.post("/v1/windows/", json=payload) | ||
resp = await api_client.post("/v1/windows/", json=payload) | ||
|
||
window_id = resp.json()["_id"] | ||
|
||
payload = {"id": window_id} | ||
resp = api_client.post("/v1/houses_with_window_link/", json=payload) | ||
resp = await api_client.post("/v1/houses_with_window_link/", json=payload) | ||
resp_json = resp.json() | ||
assert resp_json["windows"][0]["collection"] == "WindowAPI" | ||
|
||
|
||
def test_create_house_2(api_client): | ||
async def test_create_house_2(api_client): | ||
window = WindowAPI(x=10, y=10) | ||
window.insert() | ||
payload = {"name": "TEST", "windows": [str(window.id)]} | ||
resp = api_client.post("/v1/houses_2/", json=payload) | ||
resp = await api_client.post("/v1/houses_2/", json=payload) | ||
resp_json = resp.json() | ||
assert len(resp_json["windows"]) == 1 | ||
|
||
|
||
def test_revision_id(api_client): | ||
async def test_revision_id(api_client): | ||
payload = {"x": 10, "y": 20} | ||
resp = api_client.post("/v1/windows_2/", json=payload) | ||
resp = await api_client.post("/v1/windows_2/", json=payload) | ||
resp_json = resp.json() | ||
assert "revision_id" not in resp_json | ||
assert resp_json == {"x": 10, "y": 20, "_id": resp_json["_id"]} |