mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
try overriding pytest.ini variables
This commit is contained in:
@@ -132,10 +132,20 @@ def verify_email(user, redirect_url):
|
|||||||
@main.route("/sign-in", methods=(["GET", "POST"]))
|
@main.route("/sign-in", methods=(["GET", "POST"]))
|
||||||
@hide_from_search_engines
|
@hide_from_search_engines
|
||||||
def sign_in():
|
def sign_in():
|
||||||
|
|
||||||
|
if os.getenv("NOTIFY_E2E_TEST_EMAIL"):
|
||||||
|
current_app.logger.warning("E2E TESTS ARE ENABLED.")
|
||||||
|
current_app.logger.warning(
|
||||||
|
"If you are getting a 404 on signin, comment out E2E vars in .env file!"
|
||||||
|
)
|
||||||
|
user = user_api_client.get_user_by_email(os.getenv("NOTIFY_E2E_TEST_EMAIL"))
|
||||||
|
activate_user(user["id"])
|
||||||
|
return redirect(url_for("main.show_accounts_or_dashboard"))
|
||||||
|
|
||||||
# If we have to revalidated the email, send the message
|
# If we have to revalidated the email, send the message
|
||||||
# via email and redirect to the "verify your email page"
|
# via email and redirect to the "verify your email page"
|
||||||
# and don't proceed further with login
|
# and don't proceed further with login
|
||||||
current_app.logger.warning("HIT SIGNIN!")
|
|
||||||
email_verify_template = _do_login_dot_gov()
|
email_verify_template = _do_login_dot_gov()
|
||||||
if (
|
if (
|
||||||
email_verify_template
|
email_verify_template
|
||||||
@@ -146,14 +156,6 @@ def sign_in():
|
|||||||
|
|
||||||
redirect_url = request.args.get("next")
|
redirect_url = request.args.get("next")
|
||||||
|
|
||||||
if os.getenv("NOTIFY_E2E_TEST_EMAIL"):
|
|
||||||
current_app.logger.warning("E2E TESTS ARE ENABLED.")
|
|
||||||
current_app.logger.warning(
|
|
||||||
"If you are getting a 404 on signin, comment out E2E vars in .env file!"
|
|
||||||
)
|
|
||||||
user = user_api_client.get_user_by_email(os.getenv("NOTIFY_E2E_TEST_EMAIL"))
|
|
||||||
activate_user(user["id"])
|
|
||||||
return redirect(url_for("main.show_accounts_or_dashboard", next=redirect_url))
|
|
||||||
current_app.logger.warning("FAILED TO BOUNCE OUT OF SIGN IN")
|
current_app.logger.warning("FAILED TO BOUNCE OUT OF SIGN IN")
|
||||||
current_app.logger.info(f"current user is {current_user}")
|
current_app.logger.info(f"current user is {current_user}")
|
||||||
if current_user and current_user.is_authenticated:
|
if current_user and current_user.is_authenticated:
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ def end_to_end_context(browser):
|
|||||||
context = browser.new_context()
|
context = browser.new_context()
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
def pytest_generate_tests(metafunc):
|
||||||
|
os.environ['DANGEROUS_SALT'] = 'blahblahdiddiblah'
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
def authenticated_page(end_to_end_context):
|
def authenticated_page(end_to_end_context):
|
||||||
|
|||||||
@@ -12,9 +12,15 @@ E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI")
|
|||||||
|
|
||||||
def _setup(page):
|
def _setup(page):
|
||||||
# Prepare for adding a new service later in the test.
|
# Prepare for adding a new service later in the test.
|
||||||
current_app.logger.warning(f"ESE_TEST_URI={E2E_TEST_URI}")
|
print(f"ESE_TEST_URI={E2E_TEST_URI}")
|
||||||
current_app.logger.warning(f"NOTIFY_ENVIRONMENT={os.getenv('NOTIFY_ENVIRONMENT')}")
|
print(f"NOTIFY_ENVIRONMENT={os.getenv('NOTIFY_ENVIRONMENT')}")
|
||||||
current_app.logger.warning(f"E2E EMAIL {os.getenv('NOTIFY_E2E_TEST_EMAIL')}")
|
print(f"E2E EMAIL {os.getenv('NOTIFY_E2E_TEST_EMAIL')}")
|
||||||
|
print(f"E2E DANGEROUS SALT {os.getenv('DANGEROUS_SALT')}")
|
||||||
|
print(f"E2E SECRET_KEY {os.getenv('SECRET_KEY')}")
|
||||||
|
print(f"E2E ADMIN_CLIENT_SECRET {os.getenv('ADMIN_CLIENT_SECRET')}")
|
||||||
|
print(f"E2E ADMIN_CLIENT_USERNAME {os.getenv('ADMIN_CLIENT_USERNAME')}")
|
||||||
|
|
||||||
|
|
||||||
current_date_time = datetime.datetime.now()
|
current_date_time = datetime.datetime.now()
|
||||||
new_service_name = "E2E Federal Test Service {now} - {browser_type}".format(
|
new_service_name = "E2E Federal Test Service {now} - {browser_type}".format(
|
||||||
now=current_date_time.strftime("%m/%d/%Y %H:%M:%S"),
|
now=current_date_time.strftime("%m/%d/%Y %H:%M:%S"),
|
||||||
|
|||||||
Reference in New Issue
Block a user