Skip to content

Commit

Permalink
Fixes for API changes in base populator...
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Jun 18, 2022
1 parent 66f95e2 commit 71ed0e0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
8 changes: 3 additions & 5 deletions lib/galaxy/webapps/galaxy/api/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
web,
)
from galaxy.exceptions import ObjectInvalid
from galaxy.managers import (
api_keys,
base as managers_base,
users,
)
from galaxy.managers import api_keys
from galaxy.managers import base as managers_base
from galaxy.managers import users
from galaxy.managers.context import ProvidesUserContext
from galaxy.model import (
User,
Expand Down
8 changes: 4 additions & 4 deletions lib/galaxy_test/api/test_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
one_ld_library_model_store_dict,
TEST_LIBRARY_NAME,
)
from galaxy_test.base import api_asserts
from galaxy_test.base.populators import (
DatasetCollectionPopulator,
DatasetPopulator,
Expand Down Expand Up @@ -208,10 +209,9 @@ def test_show_private_dataset_permissions(self):
"ForCreateDatasets", wait=True
)
with self._different_user():
with pytest.raises(requests.exceptions.HTTPError) as exc_info:
self.library_populator.show_ld(library["id"], library_dataset["id"])
# TODO: this should really be 403 and a proper JSON exception.
self._assert_status_code_is(exc_info.value.response, 400)
response = self.library_populator.show_ld_raw(library["id"], library_dataset["id"])
api_asserts.assert_status_code_is(response, 403)
api_asserts.assert_error_code_is(response, 403002)

def test_create_dataset(self):
library, library_dataset = self.library_populator.new_library_dataset_in_private_library(
Expand Down
6 changes: 5 additions & 1 deletion lib/galaxy_test/base/populators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2319,8 +2319,12 @@ def raw_library_contents_create(self, library_id, payload, files=None):
url_rel = f"libraries/{library_id}/contents"
return self.galaxy_interactor.post(url_rel, payload, files=files)

def show_ld(self, library_id, library_dataset_id):
def show_ld_raw(self, library_id: str, library_dataset_id: str) -> Response:
response = self.galaxy_interactor.get(f"libraries/{library_id}/contents/{library_dataset_id}")
return response

def show_ld(self, library_id: str, library_dataset_id: str) -> Dict[str, Any]:
response = self.show_ld_raw(library_id, library_dataset_id)
response.raise_for_status()
return response.json()

Expand Down

0 comments on commit 71ed0e0

Please sign in to comment.