# Path: e2e-test-server/e2e_test_server/constants.py
# PROJECT_ID = os.environ["PROJECT_ID"]
# 
# PUSH_PORT = (
#     os.environ["PUSH_PORT"]
#     if SUBSCRIPTION_MODE is SubscriptionMode.PUSH
#     else None
# )
# 
# REQUEST_SUBSCRIPTION_NAME = os.environ["REQUEST_SUBSCRIPTION_NAME"]
# 
# RESPONSE_TOPIC_NAME = os.environ["RESPONSE_TOPIC_NAME"]
# 
# SCENARIO = "scenario"
# 
# STATUS_CODE = "status_code"
# 
# TEST_ID = "test_id"


import base64
import logging
from typing import Literal
from google.cloud import pubsub_v1
from google.cloud.pubsub_v1.subscriber.message import Message
from google.rpc import code_pb2
from . import scenarios, types
from .constants import (
    PROJECT_ID,
    PUSH_PORT,
    REQUEST_SUBSCRIPTION_NAME,
    RESPONSE_TOPIC_NAME,
    SCENARIO,
    STATUS_CODE,
    TEST_ID,
)
    from flask import Flask, Response, request
    from waitress import serve
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.




logger = logging.getLogger(__name__)


class _Responder:
    """Wraps pubsub publisher client back to the test server"""

    def __init__(self) -> None:
        self._publisher = pubsub_v1.PublisherClient(
            # disable buffering
            batch_settings=pubsub_v1.types.BatchSettings(max_messages=1)
        )
        self._response_topic = self._publisher.topic_path(

# Path: e2e-test-server/e2e_test_server/constants.py
# PROJECT_ID = os.environ["PROJECT_ID"]
# 
# PUSH_PORT = (
#     os.environ["PUSH_PORT"]
#     if SUBSCRIPTION_MODE is SubscriptionMode.PUSH
#     else None
# )
# 
# REQUEST_SUBSCRIPTION_NAME = os.environ["REQUEST_SUBSCRIPTION_NAME"]
# 
# RESPONSE_TOPIC_NAME = os.environ["RESPONSE_TOPIC_NAME"]
# 
# SCENARIO = "scenario"
# 
# STATUS_CODE = "status_code"
# 
# TEST_ID = "test_id"


# Path: e2e-test-server/e2e_test_server/server.py
import base64
import logging
from typing import Literal
from google.cloud import pubsub_v1
from google.cloud.pubsub_v1.subscriber.message import Message
from google.rpc import code_pb2
from . import scenarios, types
from .constants import (
    PROJECT_ID,
    PUSH_PORT,
    REQUEST_SUBSCRIPTION_NAME,
    RESPONSE_TOPIC_NAME,
    SCENARIO,
    STATUS_CODE,
    TEST_ID,
)
    from flask import Flask, Response, request
    from waitress import serve

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.




logger = logging.getLogger(__name__)


class _Responder:
    """Wraps pubsub publisher client back to the test server"""

    def __init__(self) -> None:
        self._publisher = pubsub_v1.PublisherClient(
            # disable buffering
            batch_settings=pubsub_v1.types.BatchSettings(max_messages=1)
        )
        self._response_topic = self._publisher.topic_path(

            PROJECT_ID, RESPONSE_TOPIC_NAME