def create_note(reference_type, reference_id, note_text, last_updated_by): note = models.Note(reference_type=reference_type, reference_id=reference_id, note=note_text, last_updated_by=last_updated_by) session.add(note) session.flush() return note
def test_update_schema_note(self, schema_note, mock_utcnow): new_text = "This is new text" new_user = "******" doc_tool.update_note(schema_note.id, new_text, new_user) expected_note = models.Note( reference_type=models.ReferenceTypeEnum.SCHEMA, reference_id=schema_note.reference_id, note=new_text, last_updated_by=new_user, updated_at=self.test_date ) self.assert_equal_note_update(expected_note, schema_note)
def test_create_schema_element_note(self, schema_element): actual_note = doc_tool.create_note( models.ReferenceTypeEnum.SCHEMA_ELEMENT, schema_element.id, self.note_text, self.user_email ) expected_note = models.Note( reference_type=models.ReferenceTypeEnum.SCHEMA_ELEMENT, reference_id=schema_element.id, note=self.note_text, last_updated_by=self.user_email, ) self.assert_equal_note_partial(expected_note, actual_note)