Compare commits

..

4 Commits

Author SHA1 Message Date
Andrew Shumway
6d671ef69d Add delete statement back in 2025-04-14 12:14:37 -06:00
Andrew Shumway
cc7714713f Check if delete sql statement is causing issues 2025-04-14 12:11:01 -06:00
Andrew Shumway
7596bcd982 Add migration for second e2e test user 2025-04-14 12:06:59 -06:00
Andrew Shumway
ba24485808 poetry 2025-04-14 12:02:34 -06:00
4 changed files with 253 additions and 417 deletions

View File

@@ -5,8 +5,7 @@ DATE = $(shell date +%Y-%m-%d:%H:%M:%S)
APP_VERSION_FILE = app/version.py
GIT_BRANCH ?= $(shell git symbolic-ref --short HEAD 2> /dev/null || echo "detached")
GIT_COMMIT ?= $(shell git rev-parse HEAD 2> /dev/null || echo "")
GIT_HOOKS_PATH ?= $(shell git config --global core.hooksPath || echo "")
GIT_COMMIT ?= $(shell git rev-parse HEAD)
## DEVELOPMENT
@@ -24,19 +23,6 @@ bootstrap: ## Set up everything to run the app
createdb test_notification_api || true
(poetry run flask db upgrade) || true
.PHONY: bootstrap-with-git-hooks
bootstrap-with-git-hooks: ## Sets everything up and accounts for pre-existing git hooks
make generate-version-file
poetry self add poetry-dotenv-plugin
poetry lock --no-update
poetry install --sync --no-root
git config --global --unset-all core.hooksPath
poetry run pre-commit install
git config --global core.hookspath "${GIT_HOOKS_PATH}"
createdb notification_api || true
createdb test_notification_api || true
(poetry run flask db upgrade) || true
.PHONY: bootstrap-with-docker
bootstrap-with-docker: ## Build the image to run the app in Docker
docker build -f docker/Dockerfile -t notifications-api .

View File

@@ -0,0 +1,58 @@
import datetime
import os
import uuid
import sqlalchemy as sa
from alembic import op
from app import db
from app.dao.users_dao import get_user_by_email
from app.enums import AuthType
from app.models import User
from app.utils import utc_now
revision = "0417_add_second_e2e_test_user"
down_revision = "0416_readd_e2e_test_user"
def upgrade():
email_address = os.getenv("NOTIFY_E2E_TEST_EMAIL_TWO")
password = os.getenv("NOTIFY_E2E_TEST_PASSWORD_TWO")
name = f"e2e_test_user_{uuid.uuid4()}"
data = {
"id": uuid.uuid4(),
"name": name,
"email_address": email_address,
"password": password,
"mobile_number": "+12025555555",
"state": "active",
"created_at": utc_now(),
"password_changed_at": utc_now(),
"failed_login_count": 0,
"platform_admin": "f",
"email_access_validated_at": utc_now(),
"auth_type": AuthType.SMS,
}
conn = op.get_bind()
# delete the old user because
delete_sql = f"""
delete from users where email_address='{email_address}'
"""
insert_sql = """
insert into users (id, name, email_address, _password, mobile_number, state, created_at, password_changed_at, failed_login_count, platform_admin, email_access_validated_at, auth_type)
values (:id, :name, :email_address, :password, :mobile_number, :state, :created_at, :password_changed_at, :failed_login_count, :platform_admin, :email_access_validated_at, :auth_type)
"""
conn.execute(sa.text(delete_sql))
conn.execute(sa.text(insert_sql), data)
def downgrade():
email_address = os.getenv("NOTIFY_E2E_TEST_EMAIL_TWO")
user_to_delete = get_user_by_email(email_address)
if not user_to_delete:
return
db.session.remove(user_to_delete)
db.session.commit()

592
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -52,11 +52,11 @@ faker = "^26.0.0"
async-timeout = "^5.0.1"
bleach = "^6.1.0"
geojson = "^3.2.0"
numpy = "^2.2.4"
numpy = "^2.2.3"
ordered-set = "^4.1.0"
phonenumbers = "^8.13.42"
python-json-logger = "^2.0.7"
regex = "^2024.11.6"
regex = "^2024.7.24"
shapely = "^2.0.5"
smartypants = "^2.0.1"
mistune = "^3.1.3"