Skip to content
Snippets Groups Projects

WS-858: unit test for `create_follow_on_capability_request`.

Closed Janet Goldstein requested to merge WS-858-followon-with-test-2022-01-11 into main
5 unresolved threads
  • Unit test created for create_follow_on_capability_request.

FE still pending.

Edited by Janet Goldstein

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Janet Goldstein changed title from WS-858: lay groundwork for fixing create_follow_on_capability_request. to WS-858: unit test for create_follow_on_capability_request.

    changed title from WS-858: lay groundwork for fixing create_follow_on_capability_request. to WS-858: unit test for create_follow_on_capability_request.

  • Janet Goldstein changed the description

    changed the description

121 125
122 126
123 127 @view_config(route_name="create_follow_on_capability_request", renderer="json")
124 def create_follow_on_capability_request(request: Request) -> Response:
128 def create_follow_on_capability_request(request: Request, version: CapabilityVersion) -> Response:
  • 136 141 request_id = request.matchdict["request_id"]
    137 142 followon_type = request.matchdict["followon_type"]
    138 143
    139 capability_request = request.capability_info.lookup_capability_request(request_id)
    140 parameters = capability_request.current_version.parameters
    141 user_email = parameters["user_email"]
    142
    143 previous_workflow_id = capability_request.current_execution.current_workflow_request_id
    144 previous_workflow_id = request_id
    • These are not the same thing. 'request_id' is a capability request and the other is a workflow request. Please access the workflow request id the way it was before but make it account for the correct version.

    • Please register or sign in to reply
  • 136 141 request_id = request.matchdict["request_id"]
    137 142 followon_type = request.matchdict["followon_type"]
    138 143
    139 capability_request = request.capability_info.lookup_capability_request(request_id)
    140 parameters = capability_request.current_version.parameters
    141 user_email = parameters["user_email"]
    142
    143 previous_workflow_id = capability_request.current_execution.current_workflow_request_id
    144 previous_workflow_id = request_id
    144 145
    145 metadata_content = request.workflow_service.retrieve_file_content(
    146 followon_type, previous_workflow_id, "metadata.json"
    147 )
    146 metadata_content = request.workflow_service.retrieve_file_content(previous_workflow_id, "metadata.json")
  • 145 metadata_content = request.workflow_service.retrieve_file_content(
    146 followon_type, previous_workflow_id, "metadata.json"
    147 )
    146 metadata_content = request.workflow_service.retrieve_file_content(previous_workflow_id, "metadata.json")
    148 147
    149 148 metadata = json.loads(metadata_content)
    150 149 cms_path = metadata["destinationDirectory"] + "/working"
    151 150 sdm_id = metadata["fileSetIds"][0] if isinstance(metadata["fileSetIds"], list) else metadata["fileSetIds"]
    152 151
    153 152 new_capability_request = request.capability_info.create_capability_request(
    154 followon_type, parameters={"cms_path": cms_path, "sdmId": sdm_id, "user_email": user_email}
    153 followon_type,
    154 parameters={
    155 "cms_path": cms_path,
    156 "sdmId": sdm_id,
    157 "user_email": "jgoldste@nrao.edu",
    • Probably shouldn't hardcode your email into the actual code....

      Also the new request doesn't need the parent version number, previous workflow request id or the capability name of the parent version. It's make an entirely new request of a completely different type.

    • Please register or sign in to reply
  • 172 179
    173 180 @view_config(route_name="create_and_submit_capability_request", renderer="json")
    174 181 def create_and_submit_capability_request(request: Request) -> Response:
    182 """
    183 Pyramid view to reate and submit a capability request
  • Please register or sign in to reply
    Loading