Skip to content

Commit 3c39b5d

Browse files
author
patrick.qian
committed
remove useless function; fix more tests
1 parent f716c8d commit 3c39b5d

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

source/jormungandr/jormungandr/instance_manager.py

-14
Original file line numberDiff line numberDiff line change
@@ -230,20 +230,6 @@ def _get_authorized_instances(self, user, api):
230230
authentication.abort_request(user, context)
231231
return authorized_instances
232232

233-
def _filter_authorized_instances(self, instances, api):
234-
if not instances:
235-
return []
236-
# get_user is cached hence access to database only once when cache expires.
237-
user = authentication.get_user(token=authentication.get_token())
238-
# has_access returns true if can_connect_to_database = false when cache expires for each coverage
239-
valid_instances = [
240-
i for i in instances if authentication.has_access(i.name, abort=False, user=user, api=api)
241-
]
242-
if not valid_instances:
243-
context = 'User has no access to any instance'
244-
authentication.abort_request(user, context)
245-
return valid_instances
246-
247233
def _find_coverage_by_object_id_in_instances(self, instances, object_id):
248234
if object_id.count(";") == 1 or object_id[:6] == "coord:":
249235
if object_id.count(";") == 1:

source/jormungandr/tests/journey_common_tests.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -1464,11 +1464,8 @@ def test_with_region(self):
14641464

14651465
assert status != 200, "the response should not be valid"
14661466

1467-
assert 'message' in response
1468-
assert (
1469-
response['message']
1470-
== "You don't have the permission to access the requested resource. It is either read-protected or not readable by the server."
1471-
)
1467+
assert response['error']['id'] == "unknown_object"
1468+
assert response['error']['message'] == "The region non_existent_region doesn't exists"
14721469

14731470
def test_no_region(self):
14741471
response, status = self.query_no_assert("v1/" + journey_basic_query)

0 commit comments

Comments
 (0)