Skip to content

Commit

Permalink
use snake case
Browse files Browse the repository at this point in the history
  • Loading branch information
jbukhari committed Dec 20, 2024
1 parent 6de6007 commit d982e33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions dlx_rest/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1640,8 +1640,8 @@ def get(self):
abort(404, 'Maximum limit is 1000')

if args.identifier:
if args.identifierType:
this_identifier = Identifier(args.identifierType, args.identifier)
if args.identifier_type:
this_identifier = Identifier(args.identifier_type, args.identifier)

if args.language:
# Get files for identifier by language
Expand All @@ -1650,9 +1650,9 @@ def get(self):
# Get all files for that identifier
data = [URL('api_file_record', record_id=f.id).to_str() for f in File.find_by_identifier(this_identifier)]
else:
abort(404, 'Param "identifierType" required with param "identifier"')
elif args.identifierType and not args.identifier:
abort(404, 'Param "identifier" required with param "identifierType"')
abort(404, 'Param "identifier_type" required with param "identifier"')
elif args.identifier_type and not args.identifier:
abort(404, 'Param "identifier" required with param "identifier_type"')
else:
data = [URL('api_file_record', record_id=f.id).to_str() for f in File.find({}, skip=start - 1, limit=limit)]

Expand Down
4 changes: 2 additions & 2 deletions dlx_rest/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,11 +695,11 @@ def test_api_files(client, files):
data = check_response(res)
assert f'{API}/files/f20d9f2072bbeb6691c0f9c5099b01f3' in data['data']

res = client.get(f'{API}/files?identifierType=isbn&identifier=x')
res = client.get(f'{API}/files?identifier_type=isbn&identifier=x')
data = check_response(res)
assert f'{API}/files/f20d9f2072bbeb6691c0f9c5099b01f3' in data['data']

res = client.get(f'{API}/files?identifierType=isbn&identifier=x&language=en')
res = client.get(f'{API}/files?identifier_type=isbn&identifier=x&language=en')
data = check_response(res)
assert f'{API}/files/f20d9f2072bbeb6691c0f9c5099b01f3' in data['data']

Expand Down

0 comments on commit d982e33

Please sign in to comment.