示例#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
文件: 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),
        )
示例#3
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)
示例#4
0
    def test_write_record_update(self):
        """Test that we can write an updated record."""
        # Assert task's config is not expected
        task = TaskRepository.fetch_task_by_id(self.url_task.id)
        self.assertNotEquals(task.config, {'url': 'hey'})

        # Update tasks's config
        task.config = {'url': 'hey'}
        TaskRepository.write_record(task)

        # Assert tasks' config is as expected
        task = TaskRepository.fetch_task_by_id(self.url_task.id)
        self.assertEquals(task.config, {'url': 'hey'})
示例#5
0
    def test_write_record_update(self):
        """Test that we can write an updated record."""
        # Assert task's config is not expected
        task = TaskRepository.fetch_task_by_id(self.url_task.id)
        self.assertNotEquals(task.config, {'url': 'hey'})

        # Update tasks's config
        task.config = {'url': 'hey'}
        TaskRepository.write_record(task)

        # Assert tasks' config is as expected
        task = TaskRepository.fetch_task_by_id(self.url_task.id)
        self.assertEquals(task.config, {'url': 'hey'})