Skip to content

Commit ae83a8a

Browse files
committed
feat: fixed tests
1 parent 6199c68 commit ae83a8a

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

api/tests/unit/experimentation/test_experiment_views.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ def test_get_list__with_experiments__returns_nested_feature(
287287

288288
# Then
289289
assert response.status_code == status.HTTP_200_OK
290-
data = response.json()
291-
assert len(data) == 1
292-
feature_data = data[0]["feature"]
290+
results = response.json()["results"]
291+
assert len(results) == 1
292+
feature_data = results[0]["feature"]
293293
assert isinstance(feature_data, dict)
294294
assert feature_data["id"] == multivariate_feature.id
295295
assert feature_data["name"] == multivariate_feature.name
@@ -377,8 +377,9 @@ def test_get_list__search_by_experiment_name__returns_matching(
377377

378378
# Then
379379
assert response.status_code == status.HTTP_200_OK
380-
assert len(response.json()) == 1
381-
assert response.json()[0]["id"] == experiment.id
380+
results = response.json()["results"]
381+
assert len(results) == 1
382+
assert results[0]["id"] == experiment.id
382383

383384

384385
def test_get_list__search_by_feature_name__returns_matching(
@@ -398,8 +399,9 @@ def test_get_list__search_by_feature_name__returns_matching(
398399

399400
# Then
400401
assert response.status_code == status.HTTP_200_OK
401-
assert len(response.json()) == 1
402-
assert response.json()[0]["id"] == experiment.id
402+
results = response.json()["results"]
403+
assert len(results) == 1
404+
assert results[0]["id"] == experiment.id
403405

404406

405407
def test_get_list__search_no_match__returns_empty(
@@ -416,7 +418,7 @@ def test_get_list__search_no_match__returns_empty(
416418

417419
# Then
418420
assert response.status_code == status.HTTP_200_OK
419-
assert len(response.json()) == 0
421+
assert len(response.json()["results"]) == 0
420422

421423

422424
def test_get_detail__exists__returns_200(

0 commit comments

Comments
 (0)