Example #1
0
def fake_questionnaire_store_no_submitted_at():
    storage = Mock()
    storage.get_user_data = Mock(return_value=("{}", "ce_sid", 1, None))
    questionnaire_store = QuestionnaireStore(storage)
    questionnaire_store.submitted_at = None
    questionnaire_store.metadata = {}
    questionnaire_store.answer_store = AnswerStore()
    return questionnaire_store
Example #2
0
def fake_questionnaire_store():
    storage = Mock()
    storage.get_user_data = Mock(return_value=("{}", "ce_sid", 1, None))
    questionnaire_store = QuestionnaireStore(storage)
    questionnaire_store.submitted_at = SUBMITTED_AT
    questionnaire_store.metadata = {"tx_id": "123456789", "ru_name": "Apple"}
    questionnaire_store.answer_store = AnswerStore(
        [
            Answer("name-answer", "John Smith", None).to_dict(),
            Answer("address-answer", "NP10 8XG", None).to_dict(),
        ]
    )
    return questionnaire_store
Example #3
0
def fake_questionnaire_store(fake_metadata, fake_collection_metadata):
    user_answer = Answer(answer_id="GHI", value=0, list_item_id=None)

    storage = MagicMock()
    storage.get_user_data = MagicMock(return_value=("{}", 1))
    storage.add_or_update = MagicMock()

    store = QuestionnaireStore(storage)

    store.answer_store = AnswerStore()
    store.answer_store.add_or_update(user_answer)
    store.metadata = fake_metadata
    store.collection_metadata = fake_collection_metadata

    return store
 def questionnaire_store_mock():
     storage = Mock()
     storage.get_user_data = Mock(return_value=("{}", 1))
     questionnaire_store = QuestionnaireStore(storage)
     questionnaire_store.metadata = {"tx_id": "tx_id", "case_id": "case_id"}
     return questionnaire_store