mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 07:51:13 -05:00
Added notification count to jobs.
This commit is contained in:
@@ -159,6 +159,7 @@ class Job(db.Model):
|
||||
nullable=True,
|
||||
onupdate=datetime.datetime.now)
|
||||
status = db.Column(db.Enum(*JOB_STATUS_TYPES, name='job_status_types'), nullable=False, default='pending')
|
||||
notification_count = db.Column(db.Integer, nullable=False)
|
||||
|
||||
|
||||
VERIFY_CODE_TYPES = ['email', 'sms']
|
||||
|
||||
26
migrations/versions/0020_add_job_metadata.py
Normal file
26
migrations/versions/0020_add_job_metadata.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 0020_add_job_metadata
|
||||
Revises: 0019_unique_servicename
|
||||
Create Date: 2016-02-22 12:33:02.360780
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0020_add_job_metadata'
|
||||
down_revision = '0019_unique_servicename'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('jobs', sa.Column('notification_count', sa.Integer(), nullable=False))
|
||||
### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('jobs', 'notification_count')
|
||||
### end Alembic commands ###
|
||||
@@ -159,7 +159,8 @@ def sample_job(notify_db,
|
||||
'template_id': template.id,
|
||||
'bucket_name': bucket_name,
|
||||
'file_name': file_name,
|
||||
'original_file_name': 'some.csv'
|
||||
'original_file_name': 'some.csv',
|
||||
'notification_count': 1
|
||||
}
|
||||
job = Job(**data)
|
||||
save_job(job)
|
||||
|
||||
@@ -24,7 +24,8 @@ def test_save_job(notify_db, notify_db_session, sample_template):
|
||||
'template_id': sample_template.id,
|
||||
'bucket_name': bucket_name,
|
||||
'file_name': file_name,
|
||||
'original_file_name': 'some.csv'
|
||||
'original_file_name': 'some.csv',
|
||||
'notification_count': 1
|
||||
}
|
||||
|
||||
job = Job(**data)
|
||||
|
||||
@@ -90,6 +90,7 @@ def test_create_job(notify_api, notify_db, notify_db_session, sample_template):
|
||||
'original_file_name': original_file_name,
|
||||
'bucket_name': bucket_name,
|
||||
'file_name': file_name,
|
||||
'notification_count': 1
|
||||
}
|
||||
|
||||
with notify_api.test_request_context():
|
||||
@@ -142,7 +143,8 @@ def test_get_update_job_status(notify_api,
|
||||
'bucket_name': sample_job.bucket_name,
|
||||
'file_name': sample_job.file_name,
|
||||
'original_file_name': sample_job.original_file_name,
|
||||
'status': 'in progress'
|
||||
'status': 'in progress',
|
||||
'notification_count': 1
|
||||
}
|
||||
|
||||
with notify_api.test_request_context():
|
||||
|
||||
Reference in New Issue
Block a user