Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 29 additions & 28 deletions tests/e2e/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,100 +10,101 @@
from mpt_api_client import AsyncMPTClient, MPTClient


@pytest.fixture
@pytest.fixture(scope="session")
def base_url():
return os.getenv("MPT_API_BASE_URL")


@pytest.fixture
@pytest.fixture(scope="session")
def api_timeout():
return float(os.getenv("MPT_API_TIMEOUT", "60.0"))


@pytest.fixture
@pytest.fixture(scope="session")
def mpt_vendor(base_url, api_timeout):
return MPTClient.from_config(
api_token=os.getenv("MPT_API_TOKEN_VENDOR"), base_url=base_url, timeout=api_timeout
) # type: ignore


@pytest.fixture
@pytest.fixture(scope="session")
def async_mpt_vendor(base_url, api_timeout):
return AsyncMPTClient.from_config(
api_token=os.getenv("MPT_API_TOKEN_VENDOR"), base_url=base_url, timeout=api_timeout
) # type: ignore


@pytest.fixture
@pytest.fixture(scope="session")
def mpt_ops(base_url, api_timeout):
return MPTClient.from_config(
api_token=os.getenv("MPT_API_TOKEN_OPERATIONS"), base_url=base_url, timeout=api_timeout
) # type: ignore


@pytest.fixture
@pytest.fixture(scope="session")
def async_mpt_ops(base_url, api_timeout):
return AsyncMPTClient.from_config(
api_token=os.getenv("MPT_API_TOKEN_OPERATIONS"), base_url=base_url, timeout=api_timeout
) # type: ignore


@pytest.fixture
@pytest.fixture(scope="session")
def mpt_client(base_url, api_timeout):
return MPTClient.from_config(
api_token=os.getenv("MPT_API_TOKEN_CLIENT"), base_url=base_url, timeout=api_timeout
) # type: ignore


@pytest.fixture
@pytest.fixture(scope="session")
def async_mpt_client(base_url, api_timeout):
return AsyncMPTClient.from_config(
api_token=os.getenv("MPT_API_TOKEN_CLIENT"), base_url=base_url, timeout=api_timeout
) # type: ignore


@pytest.fixture
@pytest.fixture(scope="session")
def rp_logger():
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logging.setLoggerClass(RPLogger)
return logger


@pytest.fixture
@pytest.fixture(scope="session")
def logger():
return logging.getLogger("E2E")


@pytest.fixture
@pytest.fixture(scope="session")
def project_root_path():
return pathlib.Path(__file__).parent.parent.parent


@pytest.fixture
@pytest.fixture(scope="session")
def pdf_fd():
icon_path = pathlib.Path(__file__).parent / "empty.pdf"
return pathlib.Path.open(icon_path, "rb")
with pathlib.Path.open(icon_path, "rb") as fd:
yield fd


@pytest.fixture
@pytest.fixture(scope="session")
def pdf_url():
return "https://sample-files.com/downloads/documents/pdf/basic-text.pdf"


@pytest.fixture
@pytest.fixture(scope="session")
def jpg_url():
return "https://sample-files.com/downloads/images/jpg/color_test_800x600_118kb.jpg"


@pytest.fixture
@pytest.fixture(scope="session")
def e2e_config(project_root_path):
filename = os.getenv("TEST_CONFIG_FILE", "e2e_config.test.json")
file_path = project_root_path.joinpath(filename)
return json.loads(file_path.read_text())


@pytest.fixture
@pytest.fixture(scope="session")
def product_id(e2e_config):
return e2e_config["catalog.product.id"]

Expand All @@ -118,57 +119,57 @@ def uuid_str():
return str(uuid.uuid4())


@pytest.fixture
@pytest.fixture(scope="session")
def logo_fd(project_root_path):
file_path = project_root_path / "tests/data/logo.png"
return file_path.open("rb")


@pytest.fixture
@pytest.fixture(scope="session")
def user_id(e2e_config):
return e2e_config["accounts.user.id"]


@pytest.fixture
@pytest.fixture(scope="session")
def account_id(e2e_config):
return e2e_config["accounts.account.id"]


@pytest.fixture
@pytest.fixture(scope="session")
def seller_id(e2e_config):
return e2e_config["accounts.seller.id"]


@pytest.fixture
@pytest.fixture(scope="session")
def buyer_id(e2e_config):
return e2e_config["accounts.buyer.id"]


@pytest.fixture
@pytest.fixture(scope="session")
def buyer_account_id(e2e_config):
return e2e_config["accounts.buyer.account.id"]


@pytest.fixture
@pytest.fixture(scope="session")
def licensee_id(e2e_config):
return e2e_config["accounts.licensee.id"]


@pytest.fixture
@pytest.fixture(scope="session")
def authorization_id(e2e_config):
return e2e_config["commerce.authorization.id"]


@pytest.fixture
@pytest.fixture(scope="session")
def price_list_id(e2e_config):
return e2e_config["catalog.price_list.id"]


@pytest.fixture
@pytest.fixture(scope="session")
def user_group_id(e2e_config):
return e2e_config["accounts.user_group.id"]


@pytest.fixture
@pytest.fixture(scope="session")
def commerce_product_id(e2e_config):
return e2e_config["commerce.product.id"]
2 changes: 1 addition & 1 deletion tests/e2e/helpdesk/cases/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_case_id():
return "CAS-0000-0000"

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/helpdesk/channels/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
)


@pytest.fixture
@pytest.fixture(scope="session")
def channel_id(e2e_config):
return e2e_config["helpdesk.channel.id"] # FIXME: seed data


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_channel_id():
return "CHN-0000-0000-0000"

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/helpdesk/chats/answers/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ async def async_created_chat_answer(async_chat_answers_service, chat_answer_data
yield chat_answer


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_chat_answer_id():
return "ANS-0000-0000"
2 changes: 1 addition & 1 deletion tests/e2e/helpdesk/chats/answers/parameters/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ def async_chat_answer_parameters_service(async_mpt_ops, chat_id, async_created_c
return async_mpt_ops.helpdesk.chats.answers(chat_id).parameters(async_created_chat_answer.id)


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_chat_answer_parameter_id():
return "PAR-0000-0000"
2 changes: 1 addition & 1 deletion tests/e2e/helpdesk/chats/attachment/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ async def async_created_chat_attachment(
)


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_chat_attachment_id():
return "ATT-0000-0000-0000-0000"
4 changes: 2 additions & 2 deletions tests/e2e/helpdesk/chats/conftest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import pytest


@pytest.fixture
@pytest.fixture(scope="session")
def chat_id(e2e_config):
return e2e_config["helpdesk.chat.id"]


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_chat_id():
return "CHT-0000-0000-0000"
2 changes: 1 addition & 1 deletion tests/e2e/helpdesk/chats/links/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ async def async_created_chat_link(async_chat_links_service, chat_link_data):
yield chat_link


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_chat_link_id():
return "LNK-0000-0000-0000"
2 changes: 1 addition & 1 deletion tests/e2e/helpdesk/chats/messages/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ async def async_created_chat_message(async_chat_messages_service, chat_message_d
yield chat_message


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_chat_message_id():
return "MSG-0000-0000-0000"
2 changes: 1 addition & 1 deletion tests/e2e/helpdesk/chats/participants/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ async def async_created_chat_participant(async_chat_participants_service, chat_p
yield chat_participant


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_chat_participant_id():
return "CHP-0000-0000-0000"
2 changes: 1 addition & 1 deletion tests/e2e/helpdesk/forms/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def form_data(short_uuid):
}


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_form_id():
return "FRM-0000-0000"

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/helpdesk/parameter_groups/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def parameter_group_data(short_uuid):
}


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_parameter_group_id():
return "PGR-0000-0000"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def created_parameter_group_parameter(
yield parameter_group_parameter


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_parameter_group_parameter_id():
return "PAR-0000-0000"

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/helpdesk/parameters/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def parameter_data(short_uuid):
}


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_parameter_id():
return "PAR-0000-0000"

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/helpdesk/queues/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def queue_data(short_uuid):
}


@pytest.fixture
@pytest.fixture(scope="session")
def invalid_queue_id():
return "HQU-0000-0000"

Expand Down
Loading