Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardKoschicek committed Sep 29, 2023
1 parent 75d644a commit d57b1bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions openatlas/api/endpoints/type.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from collections import defaultdict
from typing import Any, Union

from flask import Response, g, url_for
from flask import Response, g, url_for, jsonify
from flask_restful import Resource, marshal

from openatlas.api.resources.parser import default, entity_
Expand Down Expand Up @@ -79,9 +79,12 @@ def get_type_overview() -> dict[str, dict[Entity, str]]:
class GetTypeTree(Resource):
@staticmethod
def get() -> Union[tuple[Resource, int], Response]:
parser = entity_.parse_args()
type_tree = {'typeTree': GetTypeTree.get_type_tree()}
if entity_.parse_args()['download']:
if parser['download']:
return download(type_tree, type_tree_template(), 'type_tree')
if parser['count'] == 'true':
return jsonify(len(type_tree['typeTree']))
return marshal(type_tree, type_tree_template()), 200

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def test_api(self) -> None:
rv = self.app.get(url_for('api_03.licensed_file_overview'))
assert '152' in rv.get_json()
rv = self.app.get(url_for(
'api_03.licensed_file_overview'), file_id=154)
'api_03.licensed_file_overview', file_id='154'))
assert '154' in rv.get_json()

# Test Error Handling
Expand Down

0 comments on commit d57b1bb

Please sign in to comment.