Exemple #1
0
    def run_server_service():
        def snapshot_publish(message):
            server_output_message_expectd_file_path = get_message_queue_mesages_file_path(  \
                                                        ServerService.SERVICE_TYPE,         \
                                                        ParserService.SERVICE_TYPE,         \
                                                        sender_identifier=PARSER_TYPES[0])
            server_output_message_expectd = _FileHandler.read_file(
                server_output_message_expectd_file_path)
            assert server_output_message_expectd == message, f'Server snapshot message mismatch'
            sys.exit()

        run_server(SERVER_TEST_HOST, DEFAULT_PORT, publish=snapshot_publish)
Exemple #2
0
    def run_server_service(test_server_snapshot_published_counter,
                           test_server_snapshot_published_ids):
        def snapshot_publish(message):
            snapshot = MessageQueueMessages().get_message(
                MessageQueueMessagesTyeps.RAW_SNAPSHOT_MESSAGE).deserialize(
                    message)
            user_id = snapshot.user_info.user_id
            test_server_snapshot_published_ids.append(user_id)
            # Update shared-memory published snapshots counter
            test_server_snapshot_published_counter.value += 1

        run_server(SERVER_TEST_HOST, DEFAULT_PORT, publish=snapshot_publish)
def test_my_client(httpserver):
    httpserver.expect_request("/foobar").respond_with_json({"foo": "bar"})
    run_server(host='127.0.0.1', port=8000, publish=print)
    assert requests.get(httpserver.url_for("/foobar")).json() == {'foo': 'bar'}
Exemple #4
0
def cli_run_server(host, port, msg_queue_url):
    """Run server by calling for run-server with host, port and URL to a message queue"""
    run_server(host=host, port=port, msg_queue_url=msg_queue_url)
 def run_server_at_root_directory(host, port):
     delete_under_folder(get_raw_snapshot_folder_path())
     run_server(host, port)
Exemple #6
0
def run_server_at_root_directory(host, port):
    run_server(host, port)
Exemple #7
0
    def run_server_service(test_server_snapshot_published_counter):
        def snapshot_publish(message):
            # Update shared-memory published snapshots counter
            test_server_snapshot_published_counter.value += 1

        run_server(SERVER_TEST_HOST, DEFAULT_PORT, publish=snapshot_publish)