-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
56 additions
and
11 deletions.
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
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
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
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
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ dependencies: | |
- requests | ||
- click | ||
- pandas | ||
- numpy==1.26.4 |
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
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 @@ | ||
"""Pytest for method Cloudos.is_module""" | ||
import mock | ||
import responses | ||
from responses import matchers | ||
from cloudos.clos import Cloudos | ||
from tests.functions_for_pytest import load_json_file | ||
|
||
INPUT = "tests/test_data/process_workflow_list_initial_request.json" | ||
APIKEY = 'vnoiweur89u2ongs' | ||
CLOUDOS_URL = 'http://cloudos.lifebit.ai' | ||
WORKSPACE_ID = 'lv89ufc838sdig' | ||
|
||
|
||
@mock.patch('cloudos.clos', mock.MagicMock()) | ||
@responses.activate | ||
def test_is_module(): | ||
""" | ||
Test 'is_module' to work as intended | ||
API request is mocked and replicated with json files | ||
""" | ||
json_data = load_json_file(INPUT) | ||
params = {"teamId": WORKSPACE_ID, "apikey": APIKEY} | ||
header = { | ||
"Accept": "application/json, text/plain, */*", | ||
"Content-Type": "application/json;charset=UTF-8" | ||
} | ||
search_str = f"teamId={WORKSPACE_ID}&apikey={APIKEY}" | ||
# mock GET method with the .json | ||
responses.add( | ||
responses.GET, | ||
url=f"{CLOUDOS_URL}/api/v1/workflows?{search_str}", | ||
body=json_data, | ||
headers=header, | ||
match=[matchers.query_param_matcher(params)], | ||
status=200) | ||
# start cloudOS service | ||
clos = Cloudos(apikey=APIKEY, cromwell_token=None, cloudos_url=CLOUDOS_URL) | ||
# get mock response | ||
response = clos.is_module(workspace_id=WORKSPACE_ID, | ||
workflow_name="multiqc") | ||
assert response |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
_id,name,archived.status,mainFile,workflowType,repository.name,repository.platform,repository.url,repository.isPrivate | ||
XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX | ||
XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX | ||
XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX | ||
_id,name,isModule,archived.status,mainFile,workflowType,repository.name,repository.platform,repository.url,repository.isPrivate | ||
XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX | ||
XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX | ||
XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX,XXX |