Skip to content
This repository was archived by the owner on Oct 10, 2024. It is now read-only.
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ __pycache__
.pytest_cache
build
dist
.DS_STORE
venv/
*.egg-info
30 changes: 30 additions & 0 deletions mcnews/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import pytest
from mcnews.searchapi import SearchApiClient, VERSION

COLLECTION_MEDIACLOUD = "mc_search-*"

port_map = {
"prod": 8000,
"staging": 8200,
"dev": 8100
}

env_options = tuple(port_map.keys())


def pytest_addoption(parser):
parser.addoption(
"--env",
action="store",
default="prod",
help=f"Toggles which news-search-api environment to test against: {env_options}",
choices=env_options
)


@pytest.fixture(scope="class")
def api_client(request):
environment = request.config.getoption("--env")
port = port_map[environment]
request.cls._api = SearchApiClient(COLLECTION_MEDIACLOUD)
request.cls._api.API_BASE_URL = f"http://localhost:{port}/{VERSION}/"
Loading