コード例 #1
0
def get_response():
    """Instantiate a generic refget response

    Returns:
        (Response): generic refget response, compatible with refget functions
    """

    return Response()
コード例 #2
0
ファイル: server.py プロジェクト: ga4gh/refget-cloud
    def prepare(self):
        """Instantiate the generic request and response passed to refget func

        the generic request is instantiated by converting the Tornado-specific
        request object, so that it will be compatible with refget functions
        """

        self.g_request = self.get_generic_request()
        self.g_response = Response()
コード例 #3
0
def test_data(key, value):
    response = Response()
    response.put_data(key, value)
    assert response.get_datum(key) == value
    assert response.get_data()[key] == value

    new_dict = {"dataA": "valueA", "dataB": "valueB"}
    response.update_data(new_dict)
    assert response.get_datum(key) == value
    assert response.get_data()[key] == value
コード例 #4
0
def test_header(key, value):
    response = Response()
    response.put_header(key, value)
    assert response.get_header(key) == value
    assert response.get_headers()[key] == value

    new_dict = {"headerA": "valueA", "headerB": "valueB"}
    response.update_headers(new_dict)
    assert response.get_header(key) == value
    assert response.get_headers()[key] == value
コード例 #5
0
ファイル: test_media_type.py プロジェクト: ga4gh/refget-cloud
def test_media_type_middleware(request_dict, exp_status_code):
    properties = Properties({})
    request = setup_request(request_dict)
    response = Response()

    @MediaTypeMidware(properties, request, response)
    def dummy_function(properties, request, response):
        return None

    dummy_function(properties, request, response)

    assert response.get_status_code() == exp_status_code
コード例 #6
0
def test_redirect(url):
    response = Response()
    response.set_redirect_found(url)
    assert response.get_status_code() == SC.REDIRECT_FOUND
    assert response.get_header("Location") == url
コード例 #7
0
def test_status_code(status_code):
    response = Response()
    response.set_status_code(status_code)
    assert response.get_status_code() == status_code
コード例 #8
0
def test_body(body):
    response = Response()
    response.set_body(body)
    assert response.get_body() == body
コード例 #9
0
def setup_properties_request_response(props_dict, request_dict):
    return [
        setup_properties(props_dict),
        setup_request(request_dict),
        Response()
    ]