Skip to content

Commit

Permalink
fix after poetry update: no spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
paulineribeyre committed Dec 16, 2024
1 parent ce7bf8d commit e3e756d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
"filename": "tests/conftest.py",
"hashed_secret": "0dd78d9147bb410f0cb0199c5037da36594f77d8",
"is_verified": false,
"line_number": 224
"line_number": 226
}
],
"tests/migrations/test_migration_e1886270d9d2.py": [
Expand All @@ -209,5 +209,5 @@
}
]
},
"generated_at": "2024-12-16T16:26:23Z"
"generated_at": "2024-12-16T16:59:25Z"
}
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import pytest_asyncio
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
from starlette.config import environ
from threading import Thread
import uvicorn

# Set up the config *before* loading the app, which loads the configuration
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
Expand Down
24 changes: 12 additions & 12 deletions tests/test_ga4gh_tes.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async def test_get_task(client, access_token_patcher, view):
mock_arborist_request.assert_called_with(
method="POST",
path=f"/auth/request",
body=f'{{"requests": [{{"resource": "/users/{TEST_USER_ID}/gen3-workflow/tasks/123", "action": {{"service": "gen3-workflow", "method": "read"}}}}], "user": {{"token": "123"}}}}',
body=f'{{"requests":[{{"resource":"/users/{TEST_USER_ID}/gen3-workflow/tasks/123","action":{{"service":"gen3-workflow","method":"read"}}}}],"user":{{"token":"123"}}}}',
authorized=client.authorized,
)

Expand Down Expand Up @@ -129,22 +129,22 @@ async def test_create_task(client, access_token_patcher):
method="POST",
path="/tasks",
query_params={},
body=f'{{"name": "test-task", "tags": {{"AUTHZ": "/users/{TEST_USER_ID}/gen3-workflow/tasks/TASK_ID_PLACEHOLDER"}}}}',
body=f'{{"name":"test-task","tags":{{"AUTHZ":"/users/{TEST_USER_ID}/gen3-workflow/tasks/TASK_ID_PLACEHOLDER"}}}}',
status_code=client.tes_resp_code,
)

# check that the appropriate authorization checks were made
mock_arborist_request.assert_any_call(
method="POST",
path=f"/auth/request",
body=f'{{"requests": [{{"resource": "/services/workflow/gen3-workflow/tasks", "action": {{"service": "gen3-workflow", "method": "create"}}}}], "user": {{"token": "123"}}}}',
body=f'{{"requests":[{{"resource":"/services/workflow/gen3-workflow/tasks","action":{{"service":"gen3-workflow","method":"create"}}}}],"user":{{"token":"123"}}}}',
authorized=client.authorized,
)
if client.authorized and client.tes_resp_code != 500:
mock_arborist_request.assert_any_call(
method="POST",
path=f"/auth/request",
body=f'{{"requests": [{{"resource": "/users/{TEST_USER_ID}/gen3-workflow/tasks", "action": {{"service": "gen3-workflow", "method": "read"}}}}], "user": {{"token": "123"}}}}',
body=f'{{"requests":[{{"resource":"/users/{TEST_USER_ID}/gen3-workflow/tasks","action":{{"service":"gen3-workflow","method":"read"}}}}],"user":{{"token":"123"}}}}',
authorized=client.authorized,
)

Expand All @@ -169,39 +169,39 @@ async def test_create_task_new_user(client, access_token_patcher):
method="POST",
path="/tasks",
query_params={},
body=f'{{"name": "test-task", "tags": {{"AUTHZ": "/users/{NEW_TEST_USER_ID}/gen3-workflow/tasks/TASK_ID_PLACEHOLDER"}}}}',
body=f'{{"name":"test-task","tags":{{"AUTHZ":"/users/{NEW_TEST_USER_ID}/gen3-workflow/tasks/TASK_ID_PLACEHOLDER"}}}}',
status_code=200,
)

# check arborist calls
mock_arborist_request.assert_any_call(
method="POST",
path=f"/resource/users/{NEW_TEST_USER_ID}/gen3-workflow",
body=f'{{"name": "tasks", "description": "Represents workflow tasks owned by user \'test-username-{NEW_TEST_USER_ID}\'"}}',
body=f'{{"name":"tasks","description":"Represents workflow tasks owned by user \'test-username-{NEW_TEST_USER_ID}\'"}}',
authorized=True,
)
mock_arborist_request.assert_any_call(
method="POST",
path="/role",
body='{"id": "gen3-workflow_task_owner", "permissions": [{"id": "gen3-workflow-reader", "action": {"service": "gen3-workflow", "method": "read"}}, {"id": "gen3-workflow-deleter", "action": {"service": "gen3-workflow", "method": "delete"}}]}',
body='{"id":"gen3-workflow_task_owner","permissions":[{"id":"gen3-workflow-reader","action":{"service":"gen3-workflow","method":"read"}},{"id":"gen3-workflow-deleter","action":{"service":"gen3-workflow","method":"delete"}}]}',
authorized=True,
)
mock_arborist_request.assert_any_call(
method="POST",
path="/policy",
body=f'{{"id": "gen3-workflow_task_owner_sub-{NEW_TEST_USER_ID}", "description": "policy created by gen3-workflow for user \'test-username-{NEW_TEST_USER_ID}\'", "role_ids": ["gen3-workflow_task_owner"], "resource_paths": ["/users/{NEW_TEST_USER_ID}/gen3-workflow/tasks"]}}',
body=f'{{"id":"gen3-workflow_task_owner_sub-{NEW_TEST_USER_ID}","description":"policy created by gen3-workflow for user \'test-username-{NEW_TEST_USER_ID}\'","role_ids":["gen3-workflow_task_owner"],"resource_paths":["/users/{NEW_TEST_USER_ID}/gen3-workflow/tasks"]}}',
authorized=True,
)
mock_arborist_request.assert_any_call(
method="POST",
path="/user",
body=f'{{"name": "test-username-{NEW_TEST_USER_ID}"}}',
body=f'{{"name":"test-username-{NEW_TEST_USER_ID}"}}',
authorized=True,
)
mock_arborist_request.assert_any_call(
method="POST",
path=f"/user/test-username-{NEW_TEST_USER_ID}/policy",
body=f'{{"policy": "gen3-workflow_task_owner_sub-{NEW_TEST_USER_ID}"}}',
body=f'{{"policy":"gen3-workflow_task_owner_sub-{NEW_TEST_USER_ID}"}}',
authorized=True,
)

Expand Down Expand Up @@ -357,7 +357,7 @@ async def test_create_task_with_whitelist_images(
method="POST",
path="/tasks",
query_params={},
body=json.dumps(result_body),
body=json.dumps(result_body, separators=(",", ":")),
status_code=200,
)

Expand Down Expand Up @@ -481,6 +481,6 @@ async def test_delete_task(client, access_token_patcher):
mock_arborist_request.assert_called_with(
method="POST",
path=f"/auth/request",
body=f'{{"requests": [{{"resource": "/users/{TEST_USER_ID}/gen3-workflow/tasks/123", "action": {{"service": "gen3-workflow", "method": "delete"}}}}], "user": {{"token": "123"}}}}',
body=f'{{"requests":[{{"resource":"/users/{TEST_USER_ID}/gen3-workflow/tasks/123","action":{{"service":"gen3-workflow","method":"delete"}}}}],"user":{{"token":"123"}}}}',
authorized=client.authorized,
)

0 comments on commit e3e756d

Please sign in to comment.