Skip to content
Snippets Groups Projects
Commit 6862aef2 authored by Jim Sheckard's avatar Jim Sheckard
Browse files

Ws 994: Sigh

parent 17d08f61
No related branches found
No related tags found
1 merge request!870Ws 994: Sigh
Pipeline #4748 passed
Pipeline: workspaces

#4750

    ......@@ -95,18 +95,6 @@ class RetrievalConveyor(ConveyorIF):
    except:
    self.logger.warning("Unable to transmit QA notes to capability service")
    def send_qa_fail_msg(self, sdm_id: str) -> Response:
    """
    Call REST endpoint that shoots off QA Fail message
    :return:
    """
    url = (
    f"{self.settings['workflow_url']}/workflows/requests/"
    f"{self.settings['request_id']}/send-do-not-calibrate/{sdm_id}"
    )
    return requests.post(url, json={"sdm_id": sdm_id})
    def break_symlinks(self, spool_path: Path, dir_list: List[str]):
    """
    Lose the symlinks we needed temporarily
    ......
    ......@@ -110,46 +110,3 @@ class TestConveyor:
    # reset for other testing
    args.retrieve = None
    def test_main_qa_fail(self):
    """
    Test the QA Fail REST endpoint
    :return:
    """
    args.qa_fail = [TEST_JSON]
    args.fileSetIds = expected_settings["sdm_ids"]
    try:
    with patch("os.chdir"):
    with patch(PARSE_ARGS_PATCH, MagicMock(return_value=args)):
    with patch(CONVEY_PATCH) as mock_convey:
    con.main()
    assert mock_convey.call_count == 1
    finally:
    # reset for other testing
    args.qa_fail = None
    args.fileSetIds = None
    def test_send_msg_url_is_valid(self):
    """
    Check that send_qa_fail_message posts a valid URL.
    :return:
    """
    settings = copy.copy(expected_settings)
    settings["request_id"] = -1
    r_con = RetrievalConveyor(settings, "qa_fail")
    expected_url = (
    f"{settings['workflow_url']}/workflows/requests/{settings['request_id']}/"
    f"send-do-not-calibrate/{expected_settings['sdm_ids']}"
    )
    expected_response = Response(status_code=HTTPStatus.OK, json_body={"url": expected_url})
    http_conn = HTTPConnection("localhost", -1)
    with patch("requests.post", return_value=expected_response):
    with patch("urllib3.connection.HTTPConnection.connect", return_value=http_conn):
    response = r_con.send_qa_fail_msg(expected_settings["sdm_ids"])
    assert response.status_code == expected_response.status_code
    assert response.body == expected_response.body
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment