mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-11 10:28:55 -04:00
fix
This commit is contained in:
@@ -20,5 +20,5 @@ def test_create_event(notify_db_session):
|
|||||||
stmt = select(func.count()).select_from(Event)
|
stmt = select(func.count()).select_from(Event)
|
||||||
count = db.session.execute(stmt).scalar() or 0
|
count = db.session.execute(stmt).scalar() or 0
|
||||||
assert count == 1
|
assert count == 1
|
||||||
event_from_db = Event.query.first()
|
event_from_db = db.session.execute(select(Event)).scalars().first()
|
||||||
assert event == event_from_db
|
assert event == event_from_db
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from sqlalchemy import select
|
||||||
from sqlalchemy.exc import SQLAlchemyError
|
from sqlalchemy.exc import SQLAlchemyError
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
@@ -207,7 +208,7 @@ def test_update_reply_to_email_address_set_updated_to_default(sample_service):
|
|||||||
is_default=True,
|
is_default=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
results = ServiceEmailReplyTo.query.all()
|
results = db.session.execute(select(ServiceEmailReplyTo)).scalars().all()
|
||||||
assert len(results) == 2
|
assert len(results) == 2
|
||||||
for x in results:
|
for x in results:
|
||||||
if x.email_address == "change_address@email.com":
|
if x.email_address == "change_address@email.com":
|
||||||
|
|||||||
+1
-1
@@ -439,7 +439,7 @@ def create_service_permission(service_id, permission=ServicePermissionType.EMAIL
|
|||||||
permission,
|
permission,
|
||||||
)
|
)
|
||||||
|
|
||||||
service_permissions = ServicePermission.query.all()
|
service_permissions = db.session.execute(select(ServicePermission)).scalars().all()
|
||||||
|
|
||||||
return service_permissions
|
return service_permissions
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import uuid
|
|||||||
import pytest
|
import pytest
|
||||||
from flask import current_app, json
|
from flask import current_app, json
|
||||||
from freezegun import freeze_time
|
from freezegun import freeze_time
|
||||||
|
from sqlalchemy import select
|
||||||
|
|
||||||
|
from app import db
|
||||||
from app.enums import InvitedUserStatus
|
from app.enums import InvitedUserStatus
|
||||||
from app.models import Notification
|
from app.models import Notification
|
||||||
from notifications_utils.url_safe_token import generate_token
|
from notifications_utils.url_safe_token import generate_token
|
||||||
@@ -62,7 +64,7 @@ def test_create_invited_org_user(
|
|||||||
assert json_resp["data"]["status"] == InvitedUserStatus.PENDING
|
assert json_resp["data"]["status"] == InvitedUserStatus.PENDING
|
||||||
assert json_resp["data"]["id"]
|
assert json_resp["data"]["id"]
|
||||||
|
|
||||||
notification = Notification.query.first()
|
notification = db.session.execute(select(Notification)).scalars().first()
|
||||||
|
|
||||||
assert notification.reply_to_text == sample_user.email_address
|
assert notification.reply_to_text == sample_user.email_address
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from datetime import datetime
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from freezegun import freeze_time
|
from freezegun import freeze_time
|
||||||
|
from sqlalchemy import select
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
from app.dao.api_key_dao import expire_api_key
|
from app.dao.api_key_dao import expire_api_key
|
||||||
@@ -85,8 +86,12 @@ def test_deactivating_service_archives_templates(archived_service):
|
|||||||
def test_deactivating_service_creates_history(archived_service):
|
def test_deactivating_service_creates_history(archived_service):
|
||||||
ServiceHistory = Service.get_history_model()
|
ServiceHistory = Service.get_history_model()
|
||||||
history = (
|
history = (
|
||||||
ServiceHistory.query.filter_by(id=archived_service.id)
|
db.session.execute(
|
||||||
.order_by(ServiceHistory.version.desc())
|
select(ServiceHistory)
|
||||||
|
.filter_by(id=archived_service.id)
|
||||||
|
.order_by(ServiceHistory.version.desc())
|
||||||
|
)
|
||||||
|
.scalars()
|
||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
from sqlalchemy import select
|
||||||
|
|
||||||
|
from app import db
|
||||||
from app.enums import NotificationType
|
from app.enums import NotificationType
|
||||||
from app.models import ServiceDataRetention
|
from app.models import ServiceDataRetention
|
||||||
from tests import create_admin_authorization_header
|
from tests import create_admin_authorization_header
|
||||||
@@ -106,7 +109,7 @@ def test_create_service_data_retention(client, sample_service):
|
|||||||
|
|
||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
json_resp = json.loads(response.get_data(as_text=True))["result"]
|
json_resp = json.loads(response.get_data(as_text=True))["result"]
|
||||||
results = ServiceDataRetention.query.all()
|
results = db.session.execute(select(ServiceDataRetention)).scalars().all()
|
||||||
assert len(results) == 1
|
assert len(results) == 1
|
||||||
data_retention = results[0]
|
data_retention = results[0]
|
||||||
assert json_resp == data_retention.serialize()
|
assert json_resp == data_retention.serialize()
|
||||||
|
|||||||
Reference in New Issue
Block a user