Skip to content

Commit

Permalink
Test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Wudext committed Oct 9, 2024
1 parent ea0b050 commit ed1a742
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/backend/api/test_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

@pytest_asyncio.fixture
async def this_fetcher(dbsession):
global fetcher
q = sa.insert(db_models.Fetcher).values(**fetcher).returning(db_models.Fetcher)
fetcher = dbsession.scalar(q)
dbsession.flush()
Expand Down Expand Up @@ -48,6 +49,7 @@ def test_post_success(crud_client):

@pytest.mark.authenticated("pinger.fetcher.read")
def test_get_by_id_success(crud_client, this_fetcher):
global fetcher
res = crud_client.get(f"/fetcher/{this_fetcher}")
assert res.status_code == status.HTTP_200_OK
_new_fetcher = deepcopy(fetcher)
Expand Down
2 changes: 2 additions & 0 deletions tests/backend/api/test_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@pytest_asyncio.fixture
async def this_metric(dbsession):
global metric
q = sa.insert(db_models.Metric).values(**metric).returning(db_models.Metric)
metric = dbsession.scalar(q)
dbsession.flush()
Expand All @@ -36,6 +37,7 @@ def test_post_success(crud_client):

@pytest.mark.authenticated("pinger.metric.read")
def test_get_by_id_success(crud_client, this_metric):
global metric
res = crud_client.get(f"/metric/{this_metric}")
assert res.status_code == status.HTTP_200_OK
for k, v in metric.items():
Expand Down
2 changes: 2 additions & 0 deletions tests/backend/api/test_reciever.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

@pytest_asyncio.fixture
async def this_receiver(dbsession):
global receiver
q = sa.insert(db_models.Receiver).values(**receiver.model_dump()).returning(db_models.Receiver)
receiver = dbsession.execute(q).scalar()
dbsession.flush()
Expand All @@ -37,6 +38,7 @@ def test_post_success(crud_client):

@pytest.mark.authenticated("pinger.receiver.read")
def test_get_by_id_success(crud_client, this_receiver):
global receiver
res = crud_client.get(f"/receiver/{this_receiver}")
assert res.status_code == status.HTTP_200_OK
res_body = res.json()
Expand Down

0 comments on commit ed1a742

Please sign in to comment.