def test_all_data(self): eval_id = Evaluation.create("Evaluation Create Test", self.card_id).id() EvalItemData.create_or_update(self.item1_id, eval_id, "Item 1 Value") EvalItemData.create_or_update(self.item2_id, eval_id, "Item 2 Value") CommentData.create_or_update(eval_id, "Comments") TextLineData.create_or_update(self.text_line1_id, eval_id, "Text Line 1 Value") all_data = Evaluation.find_by_id(eval_id).all_data() self.assertEqual("Item 1 Value", all_data["items"][self.item1_id]) self.assertEqual("Item 2 Value", all_data["items"][self.item2_id]) self.assertEqual("", all_data["items"][self.item3_id]) self.assertEqual("Comments", all_data["comments"]) self.assertEqual("Text Line 1 Value", all_data["text"][self.text_line1_id]) self.assertEqual("", all_data["text"][self.text_line2_id])
def test_create_or_update(self): first_id = EvalItemData.create_or_update(self.item_id, self.evaluation_id, 'Item Data Test Value').id() second_id = EvalItemData.create_or_update(self.item_id, self.evaluation_id, 'Item Data Test New Value').id() self.assertEqual(first_id, second_id) item_data = EvalItemData.find_by_id(second_id) self.assertEqual('Item Data Test New Value', item_data.value)