mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-22 15:26:09 -04:00
Compare commits
4 Commits
04-15-2025
...
add-second
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d671ef69d | ||
|
|
cc7714713f | ||
|
|
7596bcd982 | ||
|
|
ba24485808 |
16
Makefile
16
Makefile
@@ -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 .
|
||||
|
||||
58
migrations/versions/0417_add_second_e2e_test_user.py
Normal file
58
migrations/versions/0417_add_second_e2e_test_user.py
Normal 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
592
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user