mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-08 20:53:11 -04:00
fix
This commit is contained in:
@@ -3,6 +3,7 @@ from datetime import datetime
|
||||
|
||||
import pytest
|
||||
from freezegun import freeze_time
|
||||
from sqlalchemy import select
|
||||
|
||||
from app import db
|
||||
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):
|
||||
ServiceHistory = Service.get_history_model()
|
||||
history = (
|
||||
ServiceHistory.query.filter_by(id=archived_service.id)
|
||||
.order_by(ServiceHistory.version.desc())
|
||||
db.session.execute(
|
||||
select(ServiceHistory)
|
||||
.filter_by(id=archived_service.id)
|
||||
.order_by(ServiceHistory.version.desc())
|
||||
)
|
||||
.scalars()
|
||||
.first()
|
||||
)
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import json
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import select
|
||||
|
||||
from app import db
|
||||
from app.enums import NotificationType
|
||||
from app.models import ServiceDataRetention
|
||||
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
|
||||
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
|
||||
data_retention = results[0]
|
||||
assert json_resp == data_retention.serialize()
|
||||
|
||||
Reference in New Issue
Block a user