mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-08 23:23:12 -04:00
remove default postage from noti history
also add test for notification_history properly setting
This commit is contained in:
@@ -1436,7 +1436,7 @@ class NotificationHistory(db.Model, HistoryModel):
|
|||||||
created_by = db.relationship('User')
|
created_by = db.relationship('User')
|
||||||
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), nullable=True)
|
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), nullable=True)
|
||||||
|
|
||||||
postage = db.Column(db.String, nullable=True, default='second')
|
postage = db.Column(db.String, nullable=True)
|
||||||
CheckConstraint("notification_type != 'letter' or postage in ('first', 'second')")
|
CheckConstraint("notification_type != 'letter' or postage in ('first', 'second')")
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from app.config import TaskNames, QueueNames
|
|||||||
from app.models import (
|
from app.models import (
|
||||||
Job,
|
Job,
|
||||||
Notification,
|
Notification,
|
||||||
|
NotificationHistory,
|
||||||
EMAIL_TYPE,
|
EMAIL_TYPE,
|
||||||
KEY_TYPE_NORMAL,
|
KEY_TYPE_NORMAL,
|
||||||
KEY_TYPE_TEAM,
|
KEY_TYPE_TEAM,
|
||||||
@@ -483,12 +484,15 @@ def test_post_precompiled_letter_notification_returns_201(client, notify_user, m
|
|||||||
|
|
||||||
s3mock.assert_called_once_with(ANY, b'letter-content', precompiled=True)
|
s3mock.assert_called_once_with(ANY, b'letter-content', precompiled=True)
|
||||||
|
|
||||||
notification = Notification.query.first()
|
notification = Notification.query.one()
|
||||||
|
|
||||||
assert notification.billable_units == 3
|
assert notification.billable_units == 3
|
||||||
assert notification.status == NOTIFICATION_PENDING_VIRUS_CHECK
|
assert notification.status == NOTIFICATION_PENDING_VIRUS_CHECK
|
||||||
assert notification.postage == postage
|
assert notification.postage == postage
|
||||||
|
|
||||||
|
notification_history = NotificationHistory.query.one()
|
||||||
|
assert notification_history.postage == postage
|
||||||
|
|
||||||
resp_json = json.loads(response.get_data(as_text=True))
|
resp_json = json.loads(response.get_data(as_text=True))
|
||||||
assert resp_json == {'id': str(notification.id), 'reference': 'letter-reference'}
|
assert resp_json == {'id': str(notification.id), 'reference': 'letter-reference'}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user