Skip to content

Commit

Permalink
fix unit test issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tianj7 committed Nov 9, 2023
1 parent d9292c1 commit 9a4d9f3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/argowrapper/engine/argo_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,9 @@ def workflow_submission(
# If billing_id exists for user, add it to workflow label and pod metadata
# remove gen3-username from pod metadata
if billing_id and len(billing_id) > 0:
workflow_yaml["metadata"]["labels"]["billing_id"] = billing_id
workflow_yaml["metadata"]["labels"]["gen3billing_id"] = billing_id
pod_labels = workflow_yaml["spec"]["podMetadata"]["labels"]
pod_labels["billing_id"] = billing_id
pod_labels["gen3billing_id"] = billing_id
pod_labels["gen3username"] = ""

logger.debug(workflow_yaml)
Expand Down
6 changes: 4 additions & 2 deletions test/test_argo_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ def test_argo_engine_submit_with_billing_id():
"body"
]._data_store
assert (
workflow_yaml["workflow"]["metadata"]["labels"]["billing_id"]
== workflow_yaml["workflow"]["spec"]["podMetadata"]["labels"]["billing_id"]
workflow_yaml["workflow"]["metadata"]["labels"]["gen3billing_id"]
== workflow_yaml["workflow"]["spec"]["podMetadata"]["labels"][
"gen3billing_id"
]
== "1234"
)
assert (
Expand Down
5 changes: 4 additions & 1 deletion test/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,10 @@ def mock_get_workflows_for_team_projects(team_projects):
with patch("argowrapper.routes.routes.auth.authenticate") as mock_auth, patch(
"argowrapper.routes.routes.argo_engine.get_workflows_for_team_projects",
mock_get_workflows_for_team_projects,
):
), patch(
"argowrapper.routes.routes.argo_engine.get_workflows_for_user"
) as mock_get_workflows_for_user:
mock_get_workflows_for_user.return_value = []
mock_auth.return_value = True
response = client.get(
"/workflows?team_projects=team1&team_projects=team2",
Expand Down

0 comments on commit 9a4d9f3

Please sign in to comment.