Skip to content

Commit

Permalink
correct failing tests: work around testing scenario with mock QRs and…
Browse files Browse the repository at this point in the history
… the need to update research data cache.
  • Loading branch information
pbugni committed Aug 9, 2024
1 parent 538394a commit 1641407
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/test_assessment_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
from portal.models.recur import Recur
from portal.models.research_data import (
add_questionnaire_response,
invalidate_qnr_research_data,
invalidate_patient_research_data,
update_single_patient_research_data,
)
from portal.models.research_protocol import ResearchProtocol
from portal.models.role import ROLE
Expand Down Expand Up @@ -96,7 +97,6 @@ def mock_qr(
db.session.commit()
invalidate_users_QBT(user_id=user_id, research_study_id='all')
qr = db.session.merge(qr)
invalidate_qnr_research_data(qr)
add_questionnaire_response(questionnaire_response=qr, research_study_id=0)


Expand Down Expand Up @@ -323,6 +323,11 @@ def test_aggregate_response_timepoints(self):
Organization.name == 'metastatic').one())
self.promote_user(staff, role_name=ROLE.STAFF.value)
staff = db.session.merge(staff)

# testing situation, each mock_qr() call invalidates cached and adds
# only the latest to the research data cache. flush and add all
invalidate_patient_research_data(TEST_USER_ID, research_study_id=0)
update_single_patient_research_data(TEST_USER_ID)
bundle = aggregate_responses(
instrument_ids=[instrument_id],
research_study_id=0,
Expand Down

0 comments on commit 1641407

Please sign in to comment.