Exemplo n.º 1
0
def test_questionnaire_store_deletes(questionnaire_store, basic_input):
    # Given
    store = QuestionnaireStore(questionnaire_store.storage)
    store.set_metadata(basic_input["METADATA"])
    store.response_metadata = basic_input["RESPONSE_METADATA"]
    store.answer_store = AnswerStore(basic_input["ANSWERS"])
    store.progress_store = ProgressStore(basic_input["PROGRESS"])

    # When
    store.delete()

    # Then
    assert "a-test-section" not in store.progress_store
    assert store.metadata.copy() == {}
    assert len(store.answer_store) == 0
    assert store.response_metadata == {}
    def test_questionnaire_store_deletes(self):
        # Given
        expected = get_basic_input()
        store = QuestionnaireStore(self.storage)
        store.set_metadata(expected["METADATA"])
        store.collection_metadata = expected["COLLECTION_METADATA"]
        store.answer_store = AnswerStore(expected["ANSWERS"])
        store.progress_store = ProgressStore(expected["PROGRESS"])

        # When
        store.delete()  # See setUp - populates self.output_data

        # Then
        self.assertNotIn("a-test-section", store.progress_store)
        self.assertEqual(store.metadata.copy(), {})
        self.assertEqual(len(store.answer_store), 0)
        self.assertEqual(store.collection_metadata, {})