mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 19:03:30 -05:00
fix tests and flake8
This commit is contained in:
@@ -6,7 +6,6 @@ from itertools import product
|
||||
|
||||
from flask import g, request
|
||||
from flask.ctx import has_app_context, has_request_context
|
||||
from flask.logging import default_handler
|
||||
from pythonjsonlogger.jsonlogger import JsonFormatter as BaseJSONFormatter
|
||||
|
||||
LOG_FORMAT = (
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import os
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -19,7 +18,6 @@ def login_for_end_to_end_testing(browser):
|
||||
|
||||
# Wait for the next page to fully load.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
print(f"PAGE ON CONFTEST AFTER SIGNIN IS {page}")
|
||||
# Save storage state into the file.
|
||||
auth_state_path = os.path.join(
|
||||
os.getenv("NOTIFY_E2E_AUTH_STATE_PATH"), "state.json"
|
||||
@@ -50,12 +48,12 @@ def end_to_end_context(browser):
|
||||
|
||||
def pytest_generate_tests(metafunc):
|
||||
pass
|
||||
#os.environ["DANGEROUS_SALT"] = os.getenv("E2E_DANGEROUS_SALT")
|
||||
#os.environ["SECRET_KEY"] = os.getenv("E2E_SECRET_KEY")
|
||||
#os.environ["ADMIN_CLIENT_SECRET"] = os.getenv("E2E_ADMIN_CLIENT_SECRET")
|
||||
#os.environ["ADMIN_CLIENT_USERNAME"] = os.getenv("E2E_ADMIN_CLIENT_USERNAME")
|
||||
#os.environ["NOTIFY_ENVIRONMENT"] = os.getenv("E2E_NOTIFY_ENVIRONMENT")
|
||||
#os.environ["API_HOST_NAME"] = os.getenv("E2E_API_HOST_NAME")
|
||||
# os.environ["DANGEROUS_SALT"] = os.getenv("E2E_DANGEROUS_SALT")
|
||||
# os.environ["SECRET_KEY"] = os.getenv("E2E_SECRET_KEY")
|
||||
# os.environ["ADMIN_CLIENT_SECRET"] = os.getenv("E2E_ADMIN_CLIENT_SECRET")
|
||||
# os.environ["ADMIN_CLIENT_USERNAME"] = os.getenv("E2E_ADMIN_CLIENT_USERNAME")
|
||||
# os.environ["NOTIFY_ENVIRONMENT"] = os.getenv("E2E_NOTIFY_ENVIRONMENT")
|
||||
# os.environ["API_HOST_NAME"] = os.getenv("E2E_API_HOST_NAME")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@@ -70,8 +70,6 @@ def test_add_new_service_workflow(authenticated_page, end_to_end_context):
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
|
||||
|
||||
|
||||
# TODO this fails on staging due to duplicate results on 'get_by_text'
|
||||
# Check for the service name title and heading.
|
||||
# service_heading = page.get_by_text(new_service_name, exact=True)
|
||||
|
||||
@@ -3,7 +3,6 @@ import os
|
||||
import re
|
||||
import uuid
|
||||
|
||||
from flask import current_app
|
||||
from playwright.sync_api import expect
|
||||
|
||||
E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI")
|
||||
@@ -89,26 +88,20 @@ def create_new_template(page):
|
||||
|
||||
|
||||
def test_create_new_template(end_to_end_context):
|
||||
print(f"WHAT IS THE TEST EMAIL {os.getenv('NOTIFY_E2E_TEST_EMAIL')}")
|
||||
page = end_to_end_context.new_page()
|
||||
print(f"INITIAL PAGE IS {page}")
|
||||
page.goto(f"{E2E_TEST_URI}/sign-in")
|
||||
# Wait for the next page to fully load.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
print(f"PAGE ON ENTER TEST_CREATE_NEW_TEMPLATE AFTER SIGNING IN IS {page}")
|
||||
|
||||
current_date_time = datetime.datetime.now()
|
||||
new_service_name = "E2E Federal Test Service {now} - {browser_type}".format(
|
||||
now=current_date_time.strftime("%m/%d/%Y %H:%M:%S"),
|
||||
browser_type=page.context.browser.browser_type.name,
|
||||
)
|
||||
print(f"NEW SERVICE NAME {new_service_name}")
|
||||
print(f"GOING TO {E2E_TEST_URI}/accounts")
|
||||
page.goto(f"{E2E_TEST_URI}/accounts")
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
print(page)
|
||||
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
# Check the page title exists and matches what we expect.
|
||||
|
||||
@@ -68,8 +68,6 @@ def _setup(page):
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
|
||||
|
||||
|
||||
# TODO this fails on staging due to duplicate results on 'get_by_text'
|
||||
# Check for the service name title and heading.
|
||||
# service_heading = page.get_by_text(new_service_name, exact=True)
|
||||
|
||||
@@ -69,8 +69,6 @@ def _setup(page):
|
||||
# Check to make sure that we've arrived at the next page.
|
||||
page.wait_for_load_state("domcontentloaded")
|
||||
|
||||
|
||||
|
||||
# TODO this fails on staging due to duplicate results on 'get_by_text'
|
||||
# Check for the service name title and heading.
|
||||
# service_heading = page.get_by_text(new_service_name, exact=True)
|
||||
@@ -176,7 +174,7 @@ def handle_no_existing_template_case(page):
|
||||
|
||||
# Start waiting for the download
|
||||
# with page.expect_download() as download_info:
|
||||
# download_link.click()
|
||||
# download_link.click()
|
||||
# download = download_info.value
|
||||
# download.save_as("download_test_file")
|
||||
# f = open("download_test_file", "r")
|
||||
@@ -189,8 +187,8 @@ def handle_no_existing_template_case(page):
|
||||
# message and it won't be sent, but the report will still be generated, which is all
|
||||
# we care about here.
|
||||
# assert (
|
||||
# "Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time"
|
||||
# in content
|
||||
# "Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time"
|
||||
# in content
|
||||
# )
|
||||
# assert "12025555555" in content
|
||||
# assert "one-off-" in content
|
||||
|
||||
Reference in New Issue
Block a user