-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows matching from general to specific data
- Loading branch information
Showing
2 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
services/web/server/tests/unit/isolated/test_catalog_api_handlers.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from models_library.services import ServiceInput, ServiceOutput | ||
from simcore_service_webserver.catalog_api_handlers import can_connect | ||
|
||
|
||
def test_can_connect(): | ||
# Reproduces https://github.com/ITISFoundation/osparc-issues/issues/442 | ||
file_picker_outfile = { | ||
"displayOrder": 2, | ||
"label": "File Picker", | ||
"description": "Picker", | ||
"type": "data:*/*", | ||
} | ||
|
||
input_sleeper_input_1 = { | ||
"displayOrder": 1, | ||
"label": "Sleeper", | ||
"description": "sleeper input file", | ||
"type": "data:text/plain", | ||
} | ||
|
||
# data:*/* -> data:text/plain | ||
assert can_connect( | ||
from_output=ServiceOutput.parse_obj(file_picker_outfile), | ||
to_input=ServiceInput.parse_obj(input_sleeper_input_1), | ||
) | ||
assert not can_connect( | ||
from_output=ServiceOutput.parse_obj(file_picker_outfile), | ||
to_input=ServiceInput.parse_obj(input_sleeper_input_1), | ||
strict=True, | ||
) | ||
|
||
# data:text/plain -> data:*/* | ||
assert can_connect( | ||
from_output=ServiceOutput.parse_obj(input_sleeper_input_1), | ||
to_input=ServiceInput.parse_obj(file_picker_outfile), | ||
) | ||
assert can_connect( | ||
from_output=ServiceOutput.parse_obj(input_sleeper_input_1), | ||
to_input=ServiceInput.parse_obj(file_picker_outfile), | ||
strict=True, | ||
) |