mirror of
https://github.com/sartography/protocol-builder-mock.git
synced 2025-01-12 08:44:46 +00:00
A sanity test.
This commit is contained in:
parent
9e590961fa
commit
473c724fe3
125
migrations/versions/dde54f90dde2_.py
Normal file
125
migrations/versions/dde54f90dde2_.py
Normal file
@ -0,0 +1,125 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: dde54f90dde2
|
||||
Revises: d3592c4e8a39
|
||||
Create Date: 2020-02-17 17:29:52.393203
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'dde54f90dde2'
|
||||
down_revision = 'd3592c4e8a39'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('study',
|
||||
sa.Column('STUDYID', sa.Integer(), nullable=False),
|
||||
sa.Column('HSRNUMBER', sa.String(), nullable=True),
|
||||
sa.Column('TITLE', sa.String(length=80), nullable=False),
|
||||
sa.Column('NETBADGEID', sa.String(), nullable=False),
|
||||
sa.Column('Q_COMPLETE', sa.Boolean(), nullable=True),
|
||||
sa.Column('DATE_MODIFIED', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.PrimaryKeyConstraint('STUDYID')
|
||||
)
|
||||
op.create_table('investigator',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('STUDYID', sa.Integer(), nullable=True),
|
||||
sa.Column('NETBADGEID', sa.String(), nullable=False),
|
||||
sa.Column('INVESTIGATORTYPE', sa.String(), nullable=False),
|
||||
sa.Column('INVESTIGATORTYPEFULL', sa.String(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['STUDYID'], ['study.STUDYID'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('required_document',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('AUXDOCID', sa.String(), nullable=False),
|
||||
sa.Column('AUXDOC', sa.String(), nullable=False),
|
||||
sa.Column('STUDYID', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['STUDYID'], ['study.STUDYID'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('study_details',
|
||||
sa.Column('STUDYID', sa.Integer(), nullable=False),
|
||||
sa.Column('IS_IND', sa.Integer(), nullable=True),
|
||||
sa.Column('IND_1', sa.String(), nullable=True),
|
||||
sa.Column('IND_2', sa.String(), nullable=True),
|
||||
sa.Column('IND_3', sa.String(), nullable=True),
|
||||
sa.Column('IS_UVA_IND', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_IDE', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_UVA_IDE', sa.Integer(), nullable=True),
|
||||
sa.Column('IDE', sa.String(), nullable=True),
|
||||
sa.Column('IS_CHART_REVIEW', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_RADIATION', sa.Integer(), nullable=True),
|
||||
sa.Column('GCRC_NUMBER', sa.String(), nullable=True),
|
||||
sa.Column('IS_GCRC', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_PRC_DSMP', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_PRC', sa.Integer(), nullable=True),
|
||||
sa.Column('PRC_NUMBER', sa.String(), nullable=True),
|
||||
sa.Column('IS_IBC', sa.Integer(), nullable=True),
|
||||
sa.Column('IBC_NUMBER', sa.String(), nullable=True),
|
||||
sa.Column('SPONSORS_PROTOCOL_REVISION_DATE', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_SPONSOR_MONITORING', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_AUX', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_SPONSOR', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_GRANT', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_COMMITTEE_CONFLICT', sa.Integer(), nullable=True),
|
||||
sa.Column('DSMB', sa.Integer(), nullable=True),
|
||||
sa.Column('DSMB_FREQUENCY', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_DB', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_UVA_DB', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_CENTRAL_REG_DB', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_CONSENT_WAIVER', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_HGT', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_GENE_TRANSFER', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_TISSUE_BANKING', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_SURROGATE_CONSENT', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_ADULT_PARTICIPANT', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_MINOR_PARTICIPANT', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_MINOR', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_BIOMEDICAL', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_QUALITATIVE', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_PI_SCHOOL', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_PRISONERS_POP', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_PREGNANT_POP', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_FETUS_POP', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_MENTAL_IMPAIRMENT_POP', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_ELDERLY_POP', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_OTHER_VULNERABLE_POP', sa.Integer(), nullable=True),
|
||||
sa.Column('OTHER_VULNERABLE_DESC', sa.String(), nullable=True),
|
||||
sa.Column('IS_MULTI_SITE', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_UVA_LOCATION', sa.Integer(), nullable=True),
|
||||
sa.Column('NON_UVA_LOCATION', sa.String(), nullable=True),
|
||||
sa.Column('MULTI_SITE_LOCATIONS', sa.String(), nullable=True),
|
||||
sa.Column('IS_OUTSIDE_CONTRACT', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_UVA_PI_MULTI', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_NOT_PRC_WAIVER', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_CANCER_PATIENT', sa.Integer(), nullable=True),
|
||||
sa.Column('UPLOAD_COMPLETE', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_FUNDING_SOURCE', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_PI_INITIATED', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_ENGAGED_RESEARCH', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_APPROVED_DEVICE', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_FINANCIAL_CONFLICT', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_NOT_CONSENT_WAIVER', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_FOR_CANCER_CENTER', sa.Integer(), nullable=True),
|
||||
sa.Column('IS_REVIEW_BY_CENTRAL_IRB', sa.Integer(), nullable=True),
|
||||
sa.Column('IRBREVIEWERADMIN', sa.String(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['STUDYID'], ['study.STUDYID'], ),
|
||||
sa.PrimaryKeyConstraint('STUDYID')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('study_details')
|
||||
op.drop_table('required_document')
|
||||
op.drop_table('investigator')
|
||||
op.drop_table('study')
|
||||
# ### end Alembic commands ###
|
@ -11,7 +11,7 @@ class Study(db.Model):
|
||||
DATE_MODIFIED = db.Column(db.DateTime(timezone=True), default=func.now())
|
||||
requirements = db.relationship("RequiredDocument", backref="study", lazy='dynamic')
|
||||
investigators = db.relationship("Investigator", backref="study", lazy='dynamic')
|
||||
study_details = db.relationship("StudyDetails", backref="study", lazy='dynamic')
|
||||
study_details = db.relationship("StudyDetails", uselist=False, backref="study")
|
||||
|
||||
class StudySchema(ma.Schema):
|
||||
class Meta:
|
||||
@ -173,3 +173,5 @@ class StudyDetails(db.Model):
|
||||
class StudyDetailsSchema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = StudyDetails
|
||||
load_instance = True
|
||||
include_relationships = False
|
||||
|
41
test_sanity.py
Normal file
41
test_sanity.py
Normal file
@ -0,0 +1,41 @@
|
||||
import json
|
||||
import os
|
||||
import unittest
|
||||
from app import app, db
|
||||
from forms import StudyForm
|
||||
from models import Study
|
||||
|
||||
|
||||
class Sanity_Check_Test(unittest.TestCase):
|
||||
|
||||
auths = {}
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.ctx = app.test_request_context()
|
||||
cls.app = app.test_client()
|
||||
db.create_all()
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
db.drop_all()
|
||||
db.session.remove()
|
||||
pass
|
||||
|
||||
def setUp(self):
|
||||
self.ctx.push()
|
||||
|
||||
def tearDown(self):
|
||||
self.ctx.pop()
|
||||
self.auths = {}
|
||||
|
||||
def test_add_study_post(self):
|
||||
"""Does add study post a new study?"""
|
||||
study = Study(TITLE="My Test Document", NETBADGEID="dhf8r")
|
||||
form = StudyForm(formdata=None, obj=study)
|
||||
r = self.app.post('/new_study', data=form.data, follow_redirects=True)
|
||||
assert r.status_code == 200
|
||||
added_study = Study.query.filter(
|
||||
Study.TITLE == "My Test Document").first()
|
||||
assert added_study
|
||||
|
Loading…
x
Reference in New Issue
Block a user