Ejemplo n.º 1
0
    def test_moments_query_delete(self):
        """Test case for moments_query_delete

        Delete moments by query.
        """
        body = Query()
        response = self.client.open('/moments/query',
                                    method='DELETE',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
Ejemplo n.º 2
0
    def test_running_record_query_post(self):
        """Test case for running_record_query_post

        Query running records.
        """
        body = Query()
        response = self.client.open('/running_record/query',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
Ejemplo n.º 3
0
    def test_get_search_results(self):
        """Test case for get_search_results

        Runs a given SELECT Query
        """
        query = Query()
        response = self.client.open('/v1/search',
                                    method='POST',
                                    data=json.dumps(query),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
    def test_query(self):
        """Test case for query

        Query using a predefined query type
        """
        body = Query()
        response = self.client.open('//query',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
Ejemplo n.º 5
0
def running_record_query_post(body):  # noqa: E501
    """Query running records.

     # noqa: E501

    :param body: Queries only include query key with the format:  [[_id1, start_time1],[_id2, start_time2]].
    :type body: dict | bytes

    :rtype: None
    """
    if connexion.request.is_json:
        body = Query.from_dict(connexion.request.get_json())  # noqa: E501
    return 'do some magic!'
Ejemplo n.º 6
0
def running_record_query_delete(body):  # noqa: E501
    """Delete running records by query.

     # noqa: E501

    :param body: Same format as querying existing running records, only contain query_key.
    :type body: dict | bytes

    :rtype: None
    """
    if connexion.request.is_json:
        body = Query.from_dict(connexion.request.get_json())  # noqa: E501
    return 'do some magic!'
Ejemplo n.º 7
0
def moments_query_post(body):  # noqa: E501
    """Query moments.

     # noqa: E501

    :param body: Queries only include query key with the format:  [[user_id1, time1],[user_id2, time2]].
    :type body: dict | bytes

    :rtype: None
    """
    if connexion.request.is_json:
        body = Query.from_dict(connexion.request.get_json())  # noqa: E501
    return 'do some magic!'
def query(body):  # noqa: E501
    """Query using a predefined query type

     # noqa: E501

    :param body: Query information to be submitted
    :type body: dict | bytes

    :rtype: Response
    """
    if connexion.request.is_json:
        body = Query.from_dict(connexion.request.get_json())  # noqa: E501
    return KBA.processQuery(body)
Ejemplo n.º 9
0
def query(request_body):  # noqa: E501
    """Query reasoner via one of several inputs

     # noqa: E501

    :param body: Query information to be submitted
    :type body: dict | bytes

    :rtype: Message
    """
    if connexion.request.is_json:
        body = Query.from_dict(connexion.request.get_json())  # noqa: E501
        print(body)
        return ui.query(body.query_message.query_graph)

    return ({
        "status": 400,
        "title": "body content not JSON",
        "detail": "Required body content is not JSON",
        "type": "about:blank"
    }, 400)