Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit 357f6c3

Browse files
Migrate test fixtures
1 parent d7c1e56 commit 357f6c3

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

seamapi/workspaces.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def reset_sandbox(self) -> None:
118118
------
119119
ResetSandBoxResponse
120120
"""
121-
res = self.seam.make_request(
121+
self.seam.make_request(
122122
"POST",
123123
"/workspaces/reset_sandbox",
124124
)

tests/conftest.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,19 @@ class SeamBackend:
2828
@pytest.fixture(scope="function")
2929
def seam_backend():
3030
with PostgresContainer("postgres:13", dbname="postgres") as pg:
31-
db_host = "host.docker.internal" if sys.platform == "darwin" else "172.17.0.1"
31+
db_host = (
32+
"host.docker.internal"
33+
if sys.platform == "darwin"
34+
else "172.17.0.1"
35+
)
3236
db_url = f"postgresql://test:test@{db_host}:{pg.get_exposed_port(pg.port_to_expose)}/postgres"
33-
with DockerContainer(os.environ.get("SEAM_CONNECT_IMAGE", "ghcr.io/seamapi/seam-connect")).with_env(
34-
"DATABASE_URL",
35-
db_url,
36-
).with_env("POSTGRES_DATABASE", "postgres").with_env(
37+
with DockerContainer(
38+
os.environ.get(
39+
"SEAM_CONNECT_IMAGE", "ghcr.io/seamapi/seam-connect"
40+
)
41+
).with_env("DATABASE_URL", db_url,).with_env(
42+
"POSTGRES_DATABASE", "postgres"
43+
).with_env(
3744
"NODE_ENV", "test"
3845
).with_env(
3946
"POSTGRES_HOST", db_host
@@ -59,8 +66,5 @@ def seam_backend():
5966
@pytest.fixture
6067
def seam(seam_backend: Any, dotenv_fixture: Any):
6168
seam = Seam(api_url=seam_backend.url, api_key=seam_backend.sandbox_api_key)
62-
requests.post(
63-
f"{seam.api_url}/workspaces/reset_sandbox",
64-
headers={"Authorization": f"Bearer {seam.api_key}"},
65-
)
69+
seam.make_request("POST", "/workspaces/reset_sandbox")
6670
yield seam

tests/fixtures/run_august_factory.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44

55

66
def run_august_factory(seam: Seam):
7-
requests.post(
8-
f"{seam.api_url}/internal/scenarios/factories/load",
7+
seam.make_request(
8+
"POST",
9+
"/internal/scenarios/factories/load",
910
json={
1011
"factory_name": "create_august_devices",
1112
"input": {"num": 1},
1213
"sync": True,
1314
},
14-
headers={
15-
"Authorization": f"Bearer {seam.api_key}",
16-
},
1715
)
1816

1917
# TODO remove when sync is supported in /internal/scenarios/factories/load

0 commit comments

Comments
 (0)