def test_write_record_new(self): """Test that we can create a new record.""" entity = TaskEntity.get_mock_object() TaskRepository.write_record(TaskMapper.to_record(entity)) task = TaskRepository.fetch_task_by_id(entity.id) self.assertEquals(task.id, entity.id)
def test_to_record(self): """Test that an entity can be converted into a record.""" entity = TaskMapper.to_entity(self.url_task) record = TaskMapper.to_record(entity) for c in record.__table__.columns: self.assertEquals(getattr(record, c.name), getattr(self.url_task, c.name))
def write_task(cls, task): """Writes TaskEntity to the repository. :param TaskEntity task: """ task.validate() TaskRepository.write_record( TaskMapper.to_record(task), )
def test_write_record_new(self): """Test that we can create a new record.""" entity = TaskEntity.get_mock_object() TaskRepository.write_record( TaskMapper.to_record(entity) ) task = TaskRepository.fetch_task_by_id(entity.id) self.assertEquals(task.id, entity.id)