def _create_relationship_store_and_update_answer(self, relationship_answer_id, answer, form_data, list_item_id, to_list_item_id): try: relationship_store = RelationshipStore(answer.value) except AttributeError: relationship_store = RelationshipStore() relationship_answer = form_data.get(relationship_answer_id) relationship = Relationship(list_item_id, to_list_item_id, relationship_answer) relationship_store.add_or_update(relationship) self._answer_store.add_or_update( Answer(relationship_answer_id, relationship_store.serialize()))
def test_serialisation(): relationship_store = RelationshipStore(relationships) assert relationship_store.serialize() == relationships