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 = TextLineData.create_or_update(self.text_line_id, self.evaluation_id, 'Text Line Data Test Value').id() second_id = TextLineData.create_or_update(self.text_line_id, self.evaluation_id, 'Text Line Data Test New Value').id() self.assertEqual(first_id, second_id) text_line_data = TextLineData.find_by_id(second_id) self.assertEqual('Text Line Data Test New Value', text_line_data.value)