Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#551

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

#551

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions performance_test/test_objects_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,50 @@ def make_request():
assert result.json()["count"] == 5000

benchmark_assertions(mean=1, max=1)


@pytest.mark.benchmark(max_time=60, min_rounds=5)
def test_objects_api_list_page5(benchmark, benchmark_assertions):
"""
Regression test for maykinmedia/objects-api#538
"""
params = {
"pageSize": 1000,
"page": 5,
"type": "http://localhost:8001/api/v2/objecttypes/f1220670-8ab7-44f1-a318-bd0782e97662",
"data_attrs": "kiemjaar__exact__1234",
"ordering": "-record__data__contactmoment__datumContact",
}

def make_request():
return requests.get((BASE_URL / "objects").set(params), headers=AUTH_HEADERS)

result = benchmark(make_request)

assert result.status_code == 200
assert result.json()["count"] == 5000

benchmark_assertions(mean=1, max=1)

@pytest.mark.benchmark(max_time=60, min_rounds=5)
def test_objects_api_list_page20(benchmark, benchmark_assertions):
"""
Regression test for maykinmedia/objects-api#538
"""
params = {
"pageSize": 20,
"page": 50,
"type": "http://localhost:8001/api/v2/objecttypes/f1220670-8ab7-44f1-a318-bd0782e97662",
"data_attrs": "kiemjaar__exact__1234",
"ordering": "-record__data__contactmoment__datumContact",
}

def make_request():
return requests.get((BASE_URL / "objects").set(params), headers=AUTH_HEADERS)

result = benchmark(make_request)

assert result.status_code == 200
assert result.json()["count"] == 5000

benchmark_assertions(mean=1, max=1)