Commit Graph
51 Commits
Author SHA1 Message Date
davelopez 194c8206c8 Check if the dataset is in the library folder
This check is more robust than the previous one,
which was based on the update time of the folder.
2025-02-19 19:13:46 +01:00
davelopez 55874283c9 Relax time comparison in test_create_dataset_in_subfolder
To avoid slight time differences on slow systems like CI.
2025-02-19 15:51:32 +01:00
Nicola Soranzo f7c5769ca5 Always validate hashes when provided
Currently when uploading datasets with associated hashes, this were
only validated if `validate_hashes=True` was also passed in the
request.

This commit drops `validate_hashes` completely and always validates
hashes when they were provided.
2024-11-05 23:21:51 +00:00
Arash 110e46781a Using DecodedDatabaseIdField instead of Union[DecodedDatabaseIdField, LibraryFolderDatabaseIdField] for library_id and fix _create_dataset_in_folder_in_library function that is leading to failed tests 2024-10-02 14:48:59 +02:00
Arash 5f323a567b Fix test_libraries erros 2024-09-26 18:46:12 +02:00
Arash eb36c65bb3 Add json=true to library_content api tests 2024-09-26 16:35:17 +02:00
Nicola Soranzo c065fa94e2 Change model_class of LibraryDatasetsManager to LibraryDataset
and make `update()` method compatible with supertype.
Fix the following mypy error:

```
lib/galaxy/managers/library_datasets.py:57: error: Signature of "update"
incompatible with supertype "ModelManager"  [override]
        def update(self, trans, ld, payload):
        ^
lib/galaxy/managers/library_datasets.py:57: note:      Superclass:
lib/galaxy/managers/library_datasets.py:57: note:          def update(self, item: Any, new_values: Any, flush: Any = ..., **kwargs: Any) -> DatasetInstance
lib/galaxy/managers/library_datasets.py:57: note:      Subclass:
lib/galaxy/managers/library_datasets.py:57: note:          def update(self, trans: Any, ld: Any, payload: Any) -> Any
```

Also:
- Move `check_modifiable()` check to API method.
- More type annotations.
2024-09-03 20:06:01 +01:00
Nicola Soranzo 0629908541 Fix new UP031 errors from ruff 0.4.2 2024-04-29 00:09:38 +01:00
mvdbeek 2d3a822583 Update test assertion 2023-07-31 17:04:50 +02:00
davelopez 5a3ee67fa0 More ID encoding handling fixes in libraries 2023-03-29 08:55:53 +01:00
John Chilton e2530b46a9 private objectstores & dataset.sharable
Setup abstractions to prevent sharing transient or private per-user objects in an objectstore.
2023-02-19 10:33:20 -05:00
John Chilton 018d066e36 Useful test decorators and runtime support for annotating how tests will be used. 2022-11-26 11:28:36 -05:00
mvdbeek 304b12c143 Move things around 2022-11-16 17:01:28 +01:00
Nicola Soranzo 10802d35a9 Mark non-slow unit tests with more relevant `@skip_if_github_down` decorator 2022-11-03 18:47:31 +00:00
Nicola Soranzo 0391cd4b62 Rename FooBarTestCase test classes as TestFooBar in API, framework, performance, Selenium and ToolShed tests
These are collected by pytest only because they are `unittest.TestCase` derived,
but normally pytest collects only test classes whose name starts with `Test`, see
https://docs.pytest.org/en/7.1.x/reference/reference.html#confval-python_classes

Also:
- Some type annotations
2022-10-15 17:54:31 +01:00
davelopez adf33758e4 Adapt API tests to explicitly use JSON in post 2022-06-30 10:51:53 +02:00
mvdbeek 83d110bef7 Merge branch 'release_22.05' into dev 2022-06-23 17:01:15 +02:00
mvdbeek 90c2c1fa48 Fix serialization response for importing datasets from folders
And remove `default_view` query parameter parsing. That was never meant
to be definable via the API, users were meant to set the view, and the
controller code sets the appropriate default_view.

Fixes
https://sentry.galaxyproject.org/share/issue/e26374bcf34f4ac0aed92c343c5a1fe6/:

```

App Only

Full

Raw
WouldBlock: null
  File "anyio/streams/memory.py", line 94, in receive
    return self.receive_nowait()
  File "anyio/streams/memory.py", line 89, in receive_nowait
    raise WouldBlock
EndOfStream: null
  File "starlette/middleware/base.py", line 43, in call_next
    message = await recv_stream.receive()
  File "anyio/streams/memory.py", line 114, in receive
    raise EndOfStream
TypeError: serialize_to_view() got multiple values for keyword argument 'default_view'
  File "starlette/middleware/base.py", line 68, in __call__
    response = await self.dispatch_func(request, call_next)
  File "galaxy/webapps/galaxy/fast_app.py", line 103, in add_x_frame_options
    response = await call_next(request)
  File "starlette/middleware/base.py", line 46, in call_next
    raise app_exc
  File "starlette/middleware/base.py", line 36, in coro
    await self.app(scope, request.receive, send_stream.send)
  File "starlette/exceptions.py", line 93, in __call__
    raise exc
  File "starlette/exceptions.py", line 82, in __call__
    await self.app(scope, receive, sender)
  File "fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "starlette/routing.py", line 670, in __call__
    await route.handle(scope, receive, send)
  File "starlette/routing.py", line 266, in handle
    await self.app(scope, receive, send)
  File "starlette/routing.py", line 65, in app
    response = await func(request)
  File "fastapi/routing.py", line 227, in app
    raw_response = await run_endpoint_function(
  File "fastapi/routing.py", line 162, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "starlette/concurrency.py", line 41, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "galaxy/webapps/galaxy/api/history_contents.py", line 593, in create
    return self.service.create(trans, history_id, payload, serialization_params)
  File "galaxy/webapps/galaxy/services/history_contents.py", line 527, in create
    return self.__create_datasets_from_library_folder(trans, history, payload, serialization_params)
  File "galaxy/webapps/galaxy/services/history_contents.py", line 1336, in __create_datasets_from_library_folder
    hda_dict = self.hda_serializer.serialize_to_view(
```
2022-06-23 13:38:00 +02:00
John Chilton 252fc386f8 Slightly modernized and standardized API error handling.
- Improved error handling and cleanup a past-John TODO.
- Moves "api/users/current" logic into a central place and allows that paradigm to work for user update.
  - Downstream this abstraction allows that logic to be used for disk usage stuff as well.
- Cleans up object store selection branches in other small ways.
2022-06-21 11:13:50 -04:00
John Chilton c5bf63bc91 Add DEFERRED datasets to Galaxy
- Improves options and display around discarded datasets.
- Adds new APIs for importing model stores.
- Adds support to model store layer for importing/exporting workflow invocations and APIs and tests to support this.
- Add new DEFERRED dataset state - with APIs for materializing them or the option to defer them on the worker node if using tool_evaluation_strategy=remote on the job destination.
- UI and API options for uploading deferred datasets individually or into collections.
2022-05-23 19:48:47 -04:00
mvdbeek 9abbac0180 Switch most tests to use `__DATA_FETCH__ instead of upload1` 2022-04-23 12:05:54 +02:00
mvdbeek 99e9747177 Fix library updates to use patch instead of put
and drop require_admin, users can have permission to update libraries
(see also dropped legacy endpoint that did not enfore this).
2022-03-21 13:14:45 +01:00
Dannon Baker 623a5e165a Apply black formatting.
Apply isort.
2022-02-03 07:42:20 -05:00
davelopez eff762cc1a Allow users with modify permission to edit libraries
This means only changing name, description and synopsis.

Includes API test
2022-01-12 18:28:34 +01:00
davelopez 85395d045c Adapt more API tests around history contents to use JSON payload
See https://github.com/galaxyproject/galaxy/pull/12152 for details
2021-12-13 11:24:44 +01:00
davelopez ed1d53888c Remove json=True in POST from flaky legacy tests 2021-11-25 10:23:07 +01:00
mvdbeek b244c5ec93 Merge branch 'release_21.09' into dev 2021-10-29 16:57:13 +02:00
mvdbeek 0736e8f834 Merge branch 'release_21.05' into release_21.09 2021-10-29 16:02:53 +02:00
mvdbeek 629ababe42 Disable library uploads using master API key
and cleanup some of the parameter validation.
2021-10-29 10:42:04 +02:00
John Chilton 9ccdc7e852 Annotate more tests as requiring Github to be online. 2021-10-05 21:51:06 -04:00
Nicola Soranzo dbb91a05db Merge branch 'release_21.05' into release_21.09 2021-10-05 12:59:56 +01:00
Nicola Soranzo 6c3a4ad535 Fix id encoding in datasets API show method
Follow-up on https://github.com/galaxyproject/galaxy/pull/12616
Fix https://github.com/galaxyproject/galaxy/issues/12610

Also:
- Add API test
- Some refactoring in `LibraryPopulator`
- Add `test_` to `ServerDirectoryValidUsageTestCase.link_data_only()`
  method name so it actually gets tested
2021-10-04 23:19:18 +01:00
davelopez d9deecee17 Fix variable naming 2021-09-15 12:31:20 +02:00
John Chilton 1efff5e320 Merge pull request #12131 from davelopez/fastapi_library_folders
Add FastAPI routes for Library Folders
2021-07-01 16:24:30 -04:00
mvdbeek 9952be7a80 Merge branch 'release_21.05' into dev 2021-07-01 10:03:48 +02:00
mvdbeek 292cd4d31d Merge branch 'release_21.01' into release_21.05 2021-07-01 09:59:09 +02:00
mvdbeek d8e94e7165 Fix running metadata tool on LDDAs
The library tests were producing datasets with failed_metadata states,
but we never asserted the state, so we never noticed this.
2021-06-30 18:46:20 +02:00
davelopez eaca2c8c2c Unify library folder API tests to use JSON 2021-06-25 12:06:15 +02:00
davelopez bfde7675c9 Adapt DELETE and PUT methods in tests 2021-06-18 17:43:39 +02:00
davelopez 53574afb51 Add API tests for library GET permissions 2021-05-26 18:10:56 +02:00
davelopez 8322a80b4a Use JSON payloads in API tests 2021-05-21 11:37:39 +02:00
davelopez b245d6d8b6 Add API tests for private libraries
There was no test for creating a folder without permission and it turns out it was possible.
2021-05-21 11:37:39 +02:00
Dannon Baker 22e7601653 First pass fstring conversion 2021-05-11 13:47:00 -04:00
davelopez 65e34290c3 Fix test randomly failing
Sometimes the dataset is not ready when calling the PATCH action resulting in the error:
"This dataset is currently being used as input or output. You cannot edit metadata until the jobs have completed or you have canceled them."
2021-02-12 13:39:43 +01:00
John Chilton 9d90da8d5f Drop last use of deprecated mixin. 2021-01-16 20:11:39 -05:00
John Chilton 7ab405e010 Expand mypy coverage in root project. 2021-01-02 21:07:21 -05:00
mvdbeek ab40223500 Add testcase that verifies imported HDCA element objects have history id 2020-11-08 11:33:20 +01:00
John Chilton 90d5dda25c Handle populating error library datasets. 2020-10-26 13:14:15 -04:00
Dannon Baker e2461e5c5b Remainder of py3-only feature updates. 2020-06-26 08:26:00 -04:00
mvdbeek 3b5a1a03d2 Add API tests library datasets as HDCA import 2020-03-25 15:57:50 +01:00