Skip to content

Commit

Permalink
Make REST API return nothing when deleting user props.
Browse files Browse the repository at this point in the history
  • Loading branch information
notoraptor committed Apr 2, 2024
1 parent 1955a3a commit cb0d2fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion clockwork_tools_test/test_mt_job_user_props.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ def test_cw_tools_delete_user_props(client):
props = client.set_user_props(job_id, cluster_name, {"a new name": "a new prop"})
assert props == {"name": "je suis une user prop 1", "a new name": "a new prop"}

props = client.delete_user_props(job_id, cluster_name, ["name"])
assert client.delete_user_props(job_id, cluster_name, ["name"]) == ""
props = client.get_user_props(job_id, cluster_name)
assert props == {"a new name": "a new prop"}
3 changes: 1 addition & 2 deletions clockwork_web/rest_routes/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ def route_user_props_delete():

# Delete props, using current_user_id as mila email username.
delete_user_props(job_id, cluster_name, keys, current_user_id)
props = get_user_props(job_id, cluster_name, current_user_id)
return jsonify(props)
return jsonify("")


# Note that this whole `user_dict_update` thing needs to be rewritten
Expand Down
7 changes: 7 additions & 0 deletions clockwork_web_test/test_rest_job_user_props.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ def test_jobs_user_props_delete(local_client, valid_rest_auth_headers_student00)
)
assert response.content_type == "application/json"
assert response.status_code == 200
assert response.get_json() == ""

response = local_client.get(
f"/api/v1/clusters/jobs/user_props/get?cluster_name={cluster_name}&job_id={job_id}",
headers=valid_rest_auth_headers_student00,
)
assert response.status_code == 200
props = response.get_json()
assert props == {"other name": "other value"}

Expand Down

0 comments on commit cb0d2fd

Please sign in to comment.