コード例 #1
0
    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)
コード例 #2
0
ファイル: test_task_mapper.py プロジェクト: minglecm/ocelot
    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))
コード例 #3
0
ファイル: task.py プロジェクト: dentafrice/ocelot
    def write_task(cls, task):
        """Writes TaskEntity to the repository.

        :param TaskEntity task:
        """
        task.validate()

        TaskRepository.write_record(
            TaskMapper.to_record(task),
        )
コード例 #4
0
    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)