Skip to content
Snippets Groups Projects
Commit dbd6da10 authored by Harsha Kethineni's avatar Harsha Kethineni
Browse files

limit for limit parameter

parent 8a35f926
No related branches found
No related tags found
No related merge requests found
......@@ -10,3 +10,4 @@ bootstrap.json
coverage.xml
/htmlcov
node_modules/
/bin/accesslog.csv
......@@ -522,6 +522,8 @@ class AccessLogReport(Report):
raise APIReportParamsException('Limit must be an integer greater than 0.')
if limit < 1:
raise APIReportParamsException('Limit must be an integer greater than 0.')
elif limit > 10000:
raise APIReportParamsException('Limit exceeds 10,000 entries, please contact admin to run script.')
for access_type in access_types:
if access_type not in AccessTypeList:
raise APIReportParamsException('Not a valid access type')
......
......@@ -116,6 +116,12 @@ def test_access_log_report(data_builder, with_user, as_user, as_admin):
r = as_admin.get('/report/accesslog', params={'limit': 0})
assert r.status_code == 400
# try to get report w/ limit == 1000 and limit > 1000
r = as_admin.get('/report/accesslog', params={'limit': 10000})
assert r.ok
r = as_admin.get('/report/accesslog', params={'limit': 10001})
assert r.status_code == 400
# get access log report for user
r = as_admin.get('/report/accesslog', params={
'start_date': yesterday_ts, 'end_date': tomorrow_ts, 'user': with_user.user
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment