예제 #1
0
    def test_dummy_async_query(self):
        connection = {"host": "hostbla", "port": "8080", "path": "/"}
        interface = async_dummy_connector.Connector(connection, None)
        query = "placeholder query text"
        query_response = interface.create_query_connection(query)

        assert query_response['query_id'] == "uuid_1234567890"
        assert query_response['code'] == 200
예제 #2
0
 def test_is_async(self):
     connection = {
         "host": "hostbla",
         "port": "8080",
         "path": "/"
     }
     check_async = async_dummy_connector.Connector(connection, None).is_async
     assert check_async
예제 #3
0
    def test_ping(self):
        connection = {
            "host": "hostbla",
            "port": "8080",
            "path": "/"
        }

        interface = async_dummy_connector.Connector(connection, None)
        ping_result = interface.ping()
        assert ping_result == "async ping"
예제 #4
0
    def test_dummy_async_results(self):
        connection = {"host": "hostbla", "port": "8080", "path": "/"}
        interface = async_dummy_connector.Connector(connection, None)
        query_id = "uuid_1234567890"
        results_response = interface.create_results_connection(query_id, 1, 1)

        success = results_response["success"]
        assert success == True
        data = results_response["data"]
        assert data == "Results for search"
예제 #5
0
    def test_dummy_async_status(self):
        connection = {"host": "hostbla", "port": "8080", "path": "/"}
        interface = async_dummy_connector.Connector(connection, None)
        query_id = "uuid_1234567890"
        status_response = interface.create_status_connection(query_id)

        success = status_response["success"]
        assert success == True
        status = status_response["status"]
        assert status == Status.COMPLETED.value
예제 #6
0
    def test_dummy_async_results_running(self):
        connection = {
            "host": "hostbla",
            "port": "8080",
            "path": "/"
        }
        results_interface = async_dummy_connector.Connector(connection, None)

        query_id = "uuid_not_done"
        offset = 0
        length = 1
        results_response = results_interface.create_results_connection(query_id, offset, length)

        query_results = results_response["error"]
        success = results_response["success"]
        assert success is not True
        assert query_results == "Query is not finished processing"
예제 #7
0
    def test_dummy_async_results_error(self):
        connection = {
            "host": "hostbla",
            "port": "8080",
            "path": "/"
        }
        results_interface = async_dummy_connector.Connector(connection, None)

        query_id = "uuid_should_error"
        offset = 0
        length = 1
        results_response = results_interface.create_results_connection(query_id, offset, length)

        success = results_response["success"]
        assert success is not True
        query_results = results_response["error"]
        assert query_results == "Error: query results not found"
예제 #8
0
    def test_dummy_async_results_success(self):
        connection = {
            "host": "hostbla",
            "port": "8080",
            "path": "/"
        }
        results_interface = async_dummy_connector.Connector(connection, None)

        query_id = "uuid_1234567890"
        offset = 0
        length = 1

        results_response = results_interface.create_results_connection(query_id, offset, length)
        query_results = results_response["data"]

        success = results_response["success"]
        assert success
        assert query_results