forked from NHSDigital/NRLF
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenvironment.py
More file actions
35 lines (23 loc) · 1.22 KB
/
environment.py
File metadata and controls
35 lines (23 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
from behave.runner import Context
from tests.features.utils.certificates import get_cert_path_for_environment
os.environ.setdefault("POWERTOOLS_LOG_LEVEL", "ERROR")
os.environ.setdefault("AWS_DEFAULT_REGION", "eu-west-2")
from nrlf.core.dynamodb.repository import DocumentPointerRepository
def before_all(context: Context):
"""
This function is called before all the tests are executed
"""
context.env = context.config.userdata.get("env")
context.account_name = context.config.userdata.get("account_name")
context.is_shared_resources = context.config.userdata.get("is_shared_resources")
context.stack_name = (
context.account_name if context.is_shared_resources else context.env
)
context.base_url = f"https://{context.env}.api.record-locator.dev.national.nhs.uk/"
context.request_id = "feature-test-request-id"
context.correlation_id = "feature-test-correlation-id"
print(f"Running tests in {context.env} environment: {context.base_url}") # noqa
default_table_name = f"nhsd-nrlf--{context.stack_name}-pointers-table"
context.client_cert = get_cert_path_for_environment(context.env)
context.repository = DocumentPointerRepository(table_name=default_table_name)